Newbie - C API Question

Greg Ewing (using news.cis.dfn.de) ckea25d02 at sneakemail.com
Tue Apr 1 02:41:06 CEST 2003


Chris Gonnerman wrote:
> From: "Ian Pellew" <ipellew at pipemedia.co.uk
>>#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
info.

-- 
Greg Ewing, Computer Science Dept,
University of Canterbury,	
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg





More information about the Python-list mailing list