Inheriting from a class inside a shared object?
Graeme Phillipson
G.P.Phillipson-97@student.lboro.ac.uk
Thu Apr 4 06:52:00 GMT 2002
Hello,
I'm trying to use swig so that I can extend a project I've already created to
have Python scripting. However I've run into some problems (I've never used
swig before BTW). I can't use the template makefiles provided, because I
already have a makefile, so I've edited Makefile.am to include:-
arguspythoninterface_wrap.o: arguspythoninterface_wrap.c
$(CC) -c -I/usr/include/python2.1/ -I/usr/lib/python2.1/config/ $<
arguspythoninterface_wrap.c: arguspythoninterface.i
swig -v -c++ -python arguspythoninterface.i
and arguspythoninterface_wrap.o is linked against when building the end
result executeable.
I also added:-
Py_Initialize();
swig_add_builtin();
PyImport_Inittab = _SwigImport_Inittab;
To my python startup code, and made a copy of embed.i and removed its main
function. However when I try this, linker errors spew forth from every corner
of my project.
The other way I thought of doing this was to start again with the interface
and make a sharded modelu my main program can link against. To test this I
tried moving examplemodule.so (which I had made from the tutorial) to my
program directory and seeing if I could load module example. When I try it
from the command line it works, but if I try it from my program it can't find
the module.
If anyone could provide me with any help in using either of those two methods
it would be greatly apprecideted.
Thanks,
Graeme Phillipson.
More information about the Gcc-help
mailing list