[arch-projects] calling python from C/C++
Aaron Griffin
aaronmgriffin at gmail.com
Wed Mar 16 15:03:26 EST 2005
ok, here's what I want to do:
---- foobar.py ---------------
class foo:
def bar(self):
print "bar called"
def foobar():
print "foobar called"
----------------------------------
and I'm gonna make up the syntax here:
----- test.c -------------------
#include <python.h> /* dunno if this is right */
void main()
{
PyObject *o;
o = PyLoadModule("foobar");
o.call("foobar");
PyObject *x;
x = PyImport("foobar.foo");
x.call("bar");
}
----------------------------------
what I want to know is the proper syntax to do this...the docs are sketchy
Also, what's the correct way to pass a C struct to python?
More information about the arch-projects
mailing list