Is ctypes appropriate in my case?

Terry Reedy tjreedy at udel.edu
Thu Oct 30 18:36:29 CET 2008


dudeja.rajat at gmail.com wrote:
> 
>     For CPython, an importable module written in C.  There is a doc
>     Extending and Embedding the Python Interpreter.  But I expect you
>     can write the class in Python with ctypes.
> 

> Thanks Terry. I'll be using ctypes now and have started writing the class.
> But the problem is that there are some 150 APIs exposed by the dll.

Ugh ;-)

> Is 
> there any tool that can autogenerate some of the member functions for 
> the class since new APIs might as well get added in future.
> 
> Could SWIG be of use here?

I have the impression that SWIG has multiple backends for different 
languages.  There is one for automating much of the work of producing an 
extension module.  I presume there could be one, if not already, that 
produced Python/cytpe code instead of C code.  That would be a nice 
thing to have.

You can find threads about real experiences with SWIG in the clp 
archives at google groups.




More information about the Python-list mailing list