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

Torsten Mohr tmohr at s.netic.de
Sat Feb 28 13:17:09 EST 2004


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