Calling C++ DLLs from Python
I'd like to know if it is possible to use ctypes to access C++ DLLs from Python and run functions (or class methods) from them.If not, is there another way t开发者_Python百科o do this?
This question has been answered many times (this one is an exact duplicate!)
In summary, no you can't do it with Ctypes (yet) but there are a number of other code generators you could use to do the job. SWIG and Boost.Python are two of the most popular.
the boost python library makes it REALLY easy to wrap a C++ class and expose it as python module. It took me around 10 minutes the first time I tried.
http://www.boost.org/doc/libs/1_42_0/libs/python/doc/tutorial/doc/html/index.html
精彩评论