Building Python as a shared lib plugin.
yann.chachkoff at mailandnews.com
Thu Aug 30 15:00:58 CEST 2001
> > > The '-Xlinker' tells gcc to pass '-export-dynamic' to ld. gcc itself
> > > seems to ignore it otherwise.
> > I of course tried this first (I always read manuals before working). It
> > does not work. I tried the following one:
> > $(CC) $(FLAGS) -shared -Wl,-soname,plugin_python.so.0 $(OBJECTS)
> > ../common/libcross.a -Xlinker -export-dynamic
> > /usr/lib/python2.0/config/libpython2.0.a -lpthread -lutil -ldmalloc -o
> > plugin_python.so.0.1
> Sorry, in tests that I did gcc silently ignored '-export-dynamic' when
> passed to it, so I thought that that might have been the problem.
I think I need to apologize myself... Your idea was good indeed, and I had
been unclear in my terms. I thank you for your support.
> From the ld man page:
> For each archive mentioned on the command line af
> ter the --whole-archive option, include every ob
> ject file in the archive in the link, rather than
> searching the archive for the required object
> files. This is normally used to turn an archive
> file into a shared library, forcing every object to
> be included in the resulting shared library.
> If I understand correctly, you may need to add '-Xlinker --whole-archive'
> before python2.0.a.
That's an idea I didn't tried before, so I did.
Unfortunately, it does not seemed to solve the problem - I always get the
I did some new variations around; I replaced the "gcc" command with direct
calls to "ld". I tried numerous combinations using --whole-archive, -E (and
others too; for example, I tried to link in more than one line using -r to be
able to "fine-tune" options for each linked library).
Whatever I did, the problem stayed the same.
I ask now a new question: has anyone already tried to make a shared library
dynamically loaded with the Python interpreter ? Is it even possible (I
suppose it is, but I do not know how) ? If yes, can you tell me where I am
More information about the Python-list