Call python function in C code -
i written small code addition 2 numbers in python.
addition.py def add(a,b): c=a+b print "result is...",c mainpgm.c ???
how call addition.py/add function in c(mainpgm) program.
already saw links not getting clear.
any suggestions call function in c.
reading the python manual,
#include <python.h> int main(int argc, char *argv[]) { py_setprogramname(argv[0]); /* optional recommended */ py_initialize(); pyrun_simplestring("import addition\naddition.add(42, 42)\n"); py_finalize(); return 0; }
might want.
Comments
Post a Comment