[C++-sig] Re: Embedding example anyone?

Berthold Höllmann hoel at germanlloyd.org
Thu Jul 11 11:19:37 CEST 2002


"Dave Hawkes" <daveh at cadlink.com> writes:

> However I can say that embedding using V2 should be particularly
> straightforward in most cases.
> 
> The best way of tying python and your own code together to make your
program
> a built-in module using something like this in c++:
> 
> PyImport_AppendInittab("MyProgram", initMyProgram);
> Py_Initialize();
> ...
> 
> where initMyProgram is your init function.
> 
> Then in python:
> 
> import MyProgram
> 
> 
> MyProgram will then behave as a built-in module. Of course there is
nothing
> to prevent you having multiple init functions in the same program and
> initialising each with PyImport_AppendInittab. That way you can have
> multiple modules for different aspects of the program.
> 
> 
> It is also possible to create c++ classes which have some member
functions
> overloaded in python, which my example should also demonstrate when
> complete.

I'm looking for a somehow different approach. We have to provide some
functionality for a C++ Program. The functions are already almost
written, but in Python. So we are looking for a easy/convenient way to
access Python code/classes/methods from C++. Is there anything
available to help us there.

Thanks

Berthold
-- 
Dipl.-Ing. Berthold Höllmann   __   Address:
hoel at germanlloyd.org        G /  \ L Germanischer Lloyd
phone: +49-40-36149-7374    -+----+- Vorsetzen 32/35    P.O.Box 111606
fax  : +49-40-36149-7320      \__/   D-20459 Hamburg    D-20416 Hamburg



This email contains confidential information for the exclusive attention
of the intended addressee. Any access of third parties to this email is
unauthorized. Any use of this email by not intended recipients like
copying, distribution, disclosure etc. is prohibited and may be
unlawful. When addressed to our clients the content of this email is
subject to the General Terms and Conditions of GL's Group of Companies
applicable at the date of this email. 

GL's Group of Companies does not warrant and/or guarantee that this
message at the moment of receipt is authentic, correct and its
communication free of errors, interruption etc. 





More information about the Cplusplus-sig mailing list