Python from C, PyRun_String()
kragen at pobox.com
Tue Jan 22 13:42:36 EST 2002
twhitema at yahoo.com.au writes:
> I was interested in running python with C, but ran into some snags
> with linking. What API/library do I link my compiled program with,
> in order to be able to run my program.
> I am using gcc with python2.1 in a unix environment.
It varies. You probably want to link at least with libpython2.1
(-L/usr/local/lib/python2.1/config -lpython2.1 on my system), but I
also have to link with -lxmlparse -ldl -lpthread -lxmltok -lutil,
because my Python was configured with dynamic loading, pthreads, and
XML support from expat.
I'm not entirely sure why libpython2.1 is in
/usr/local/lib/python2.1/config instead of someplace like
/usr/local/lib, or why it's only a static library (.a) instead of a
dynamic library (.so), but hey, it works.
More information about the Python-list