example code to access some C++ classes in a DLL

Larry Bates lbates at swamisoft.com
Sat Feb 28 17:08:09 EST 2004


You can interface Python to ANY .DLL by using
CALLDLL.  I've written a wrapper that I feel makes
doing this easier that is posted at:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/146847

-Larry

"Torsten Mohr" <tmohr at s.netic.de> wrote in message
news:c1qlv5$58m$1 at schleim.qwe.de...
> Hi,
>
> i have written a DLL that implements some C++ classes and
> their methods.  Now i would like to make the classes and
> their methods known to python.
>
> Is there some example code available on how to do this?
> I want to make some classes, their constructors and some
> methods known to python.
>
> I've read the python docu "Tutorial", "Distributing Python Modules",
> "Extending and Embedding" and "Python/X API".
> But none of them seems to tell me how i can interface to:
>
>
> namespace abc {
>   class Abc {
>     Abc();
>     ~Abc();
>
>     int meth1(int abd, std::string s);
>   };
>
>   class Def {
>     Def();
>     ~Def();
>
>     int meth1(long abd, char* g);
>   }
> }
>
> Has anybody got some example code for the necessary wrapper to make
> all the above known to python?
>
>
> Thanks for any hints,
> Torsten.
>
>





More information about the Python-list mailing list