Problem with linking embedding C application

Olivier Deme odeme at
Mon Oct 1 14:48:43 CEST 2001

Thanks for the link to the demo application.
Indeed it seems that there a plenty of libraries to link with...

Something also really annoying:
The libraries are located in an unusual place on my machine:

Plus, the fact that libpython*.a has its version number in the file name.
That means that if our customer has a different version of Python, they
won't be able to link our application!
Usually, this should be solved by adding a symbolink link in a common
directory. Sonething like:
/usr/lib/libpython.a -> /usr/local/lib/python2.1/config/libpython2.1.a

But this is not done during installation of Python. How are we supposed to know
the version used by the people who are going to build our application?
And no, I didn;t find any AUTOCONF macro to help resolving that problem...

On Mon, 1 Oct 2001, Mads Bondo Dydensborg wrote:

> On Mon, 1 Oct 2001, Olivier Deme wrote:
> > > I think that you may need to add at least
> > > -lpthread -lm -lutil
> > > to you ld line?
> > >
> > > I have a machine, where I need to do:
> > >  -lnsl -ldl -lreadline -ltermcap -lpthread -lutil -lm
> > > to be able to link with python.
> >
> > I can't believe I would have to link my application with something like pthread
> > if I don't use it! After all, Python is supposed to make an application
> > portable... Our C application is portable and needs to be shipped to a
> > customer. So including things like "pthread", "nsl" and the-like would break
> > the main reason why I decided to extend our application with some Python code.
> Well, it could still be portable, if you had a portable way of determing
> this. Among different unixs and the like, you should have no troubles. I
> have no idea about Windows, Macs and the like though.
> >
> > As far as it seems, it looks like it is way easier to embed TCL code in C,
> > rather than Python...
> > Sad, since I prefer Python.
> TCL or Perl, yes. I would prefer Python as well; perl gives me headaches,
> and tcl is annoying with its strings-strings-strings stuff.
> >
> > Maybe, we are missing some information. Is there a hello world type application
> > that would demonstrate embedding Python with C or C++?
> >
> The Python sources "Demo/embed" - the demo.c file - but, it uses a static
> Makefile.
> Mads
> --
> Mads Bondo Dydensborg.                               madsdyd at
>   7)  Sacrifice a small animal for Good Luck
>  (step 7 of 8 in configuring the Open Source Global File System for Linux)

More information about the Python-list mailing list