Embedding and extending

Gordon McMillan gmcm at hypernet.com
Fri Feb 11 04:57:46 CET 2000

Ron wrote:

> Here is my understanding from those threads:
> To do both I need three 'modules':
> 1: python
> 2: the module that extends python (.dll on Win32)
> 3: my application that embeds python (.exe on
> Win32)
> Is there a way to eliminate module 2? In other
> words, can module 3 be both the app that embeds
> python and the module that has the functions
> python can call back to?
> To elaborate: I know that a extend-module
> called 'mymod' needs an initmymod function that
> python calls when it imports it to get hold of
> the function table. When I embed python in my
> application, can I somehow hand over that
> function table to python so that my scripts can
> call back into my application?

Certainly. The only technical issue is that the python symbols 
be available; but you link against the import lib, so that's fine.

You've got a number of choices. Probably being a built-in is 
the best. Look at how they get set up and initialized.

- Gordon

More information about the Python-list mailing list