python as plugin language

Alex Martelli aleaxit at yahoo.com
Fri Jun 29 12:20:42 CEST 2001


"John Roth" <johnroth at ameritech.net> wrote in message
news:tjiok16g2asmc7 at news.supernews.com...
    ...
> All the cases you cite miss the essential point - how does the Python
> code call a function in the C language program it's embedded in? It's
    ...
> I think the functions I need are in the Python/C API, but I've never seen
> those functions referenced in any example, or in any of the books.

I may be missing something, but... doesn't the embed.c demo/example,
D:\Python-2.1\Demo\embed\demo.c on a typical Python install on Win32
for ex., do exactly what you require...?  Well, almost -- it doesn't
actually run any useful Python code, just leave a space where you
could insert your own:-).  But it does show the embedding C program
adding a module, called "xyzzy", which exposes to Python a C function,
called "foo" (from the Python side of things).  Your Python code
invoked from demo.c could "import xyzzy" and then call xyzzy.foo().

So, WHAT am I missing...?


Alex






More information about the Python-list mailing list