embedded python in dll with C
duprez at hinet.net.au
Mon Jul 16 08:13:49 CEST 2007
I can't quite get my head around embedding Python in a C app and I
have a few questions if I may, here is the background.
I want to create a dll plugin that has the Python interpreter embedded
in it for use in scripting an established application. So far I have
created the interface dll and py module using swig. So far so good,
now some questions -
1) Would it be best to combine my swig generated .c file into the same
dll as my plugin dll or leave it seperate, in other words should I
just embed the interpreter into the C 'plugin' dll and create the
interface module and dll seperately to import into python scripts?
2) Once I have done this would it be appropriate just to use something
like this in my C code -
where 'init_func_from_script' establishes callbacks for C to use from
the script using the new interface module/dll? The C application has
it's own functions for registering callbacks by passing in a list of
the functions, I'm hoping this will work.
I'll give it a go in the mean time, just looking for the right/better
way to do this, thanks.
More information about the Python-list