471,349 Members | 1,810 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,349 software developers and data experts.

embedded python in dll with C

Hi All,
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 -

PyRun_SimpleString("import my_plugin_script");

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.

Jul 16 '07 #1
0 812

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

12 posts views Thread by Brandon | last post: by
13 posts views Thread by Alexander May | last post: by
4 posts views Thread by Dennis Clark | last post: by
3 posts views Thread by Godzilla | last post: by
20 posts views Thread by Jack | last post: by
2 posts views Thread by Carl J. Van Arsdall | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.