Newbie - C API Question

Greg Ewing (using ckea25d02 at
Tue Apr 1 02:41:06 CEST 2003

Chris Gonnerman wrote:
> From: "Ian Pellew" <ipellew at
>>#include "Python.h"
>>main() {
>>    int x;
>>    PyObject *t;
>>    t = PyTuple_New(3);
>>    x = Py_file_input;
>>    printf("Hiya, x = %d\n", x);
> Your compilation command seems to be missing a -lpython to
> load libpython.a.

You'll also need to insert a call to Py_Initialize
before calling any other Python/C API functions.
See the section "Embedding Python in Another Application"
in the "Extending and "Embedding" manual for more

Greg Ewing, Computer Science Dept,
University of Canterbury,	
Christchurch, New Zealand

More information about the Python-list mailing list