What you can do is turn your C program into a module, embed it in a
tiny python program and call python modules from your C code.
The python code is real simple. Assuming you call your C module 'foo',
you do something like
import foo
def ..... # Define all python functions here, or in other modules,
# whatever you want...
foo.callmymain()
Turning your program into a module isn't too much work: rename main()
to my_main() and write a wrapper module (as described in
misc/EXTENDING) that calls your main program. You can then use
dictlookup() (I think) to find python objects and call_object() to
call those objects from your C code.
Unless you have the latest python with the dynamic loading facility
you then have to create a new python binary that includes your new
module (and your old application program as well, of course). With
dynamic loading things are a bit simpler, since you can just leave a
partially linked 'foomodule.o' around somewhere in the $PYTHONPATH,
and an 'import foo' will result in the module being dynamically linked
into the running python interpreter.
Maybe Guido can provide us with a complete sceleton example?
-- Jack Jansen | If I can't dance I don't want to be part of Jack.Jansen@cwi.nl | your revolution -- Emma Goldman uunet!cwi.nl!jack G=Jack;S=Jansen;O=cwi;PRMD=surf;ADMD=400net;C=nl