[Tutor] embedding a simple C++ program

Danny Yoo dyoo@hkn.eecs.berkeley.edu
Fri, 23 Feb 2001 01:41:38 -0800 (PST)


Dear Albert,

Hello!  Hmmm... I haven't had too much experience embedding Python into a
C/C++ application, and I'm not sure if the other tutors have responded
yet.  You might want to ask the comp.lang.python newsgroup itself about
this; there should be some experienced people there who can help.

By the way, I'll try playing with this tonight to see if I can get an
example up and running; not sure if I'll succeed immediately though...
*grin*

Good luck to you.


On Thu, 22 Feb 2001, Albert Hook wrote:

> I have a HelloWorld program, Header, body and a main body that calls
> helloworld. In that header and body I have a printHelloWorld function.
> I want to acces the methods that I create in the class HelloWorld with
> Python via the shared object.
> 
> Do I do that by importing that function into python by simply having a
> init function that calls the is has the following,
> 
> PyObject *m;
> m = Py_InitModule("helloworld". HelloWorldMethods);
> 
> Or is it much more difficult than that, if it is can I see an example.
> I have tried to use the tutorial and the demo.c, the latter doesn't
> compile and I can't see how I can access C++ methods with the
> tutorial.