Extending Python with C-Libs
Brent Fulgham
brent.fulgham at xpsystems.com
Wed Apr 5 12:46:30 EDT 2000
> I have a Library written in C with its Headerfiles but without the
> Sourcecode.
> Does anybody know an easy way to extend Python with this Library?
>
Sure -- it's no different than adding hooks for the Win32 stuff or
whatnot. Just create a new Python C extension module with an API
corresponding to the interesting pieces of the header file you have.
Then your C-extension is just a jump-off point where Python objects
come in, you convert them to whatever the C-library needs, and you
provide a valid Python-style return type.
Review the examples in the source code for details, or see Mark Lutz's
"Programming Python" book.
Regards,
-Brent
More information about the Python-list
mailing list