C
Chris Hodapp
I have seen messages posted about this before, and there is a clear
reference to it in the manual, but I have been unable to find a
solution.
I'm on Slackware 9.1, kernel 2.6.0-test11, using Python 2.3.1 and
GCC 3.2.3 (both installed by default with Slackware) and SWIG 1.3.19,
compiled from source code.
I messed around a little on my own and couldn't get things to work
right,
so I copied the examples from the book, nearly verbatim but with some
minor changes to fit my configuration.
I copied the example code exactly into example.i and example.c, and
did
the following commands:
swig -python example.i
gcc -c example.c example_wrap.c -I/usr/include/python2.3
ld -shared example.o example_wrap.o -o _example.so
.... and several other times in the last command I tried some other
things like examplemodule.so and example.so. All of these worked
without
error, so I tried it from within Python, and got the usual error about
"ImportError: dynamic module does not define init function" when I
tried
'import example'. It made no difference if I added the path with all
the
files to sys.path; the same error occurred.
I tried this several times over, and I could never get it to work
right. The last helpful suggestion I saw on here was that I did not
make the init<whatever> function public by putting
/EXPORT:init<whatever> on the linker line, but that doesn't seem to be
what GNU ld understands
Any suggestions?
Thanks,
-Chris
reference to it in the manual, but I have been unable to find a
solution.
I'm on Slackware 9.1, kernel 2.6.0-test11, using Python 2.3.1 and
GCC 3.2.3 (both installed by default with Slackware) and SWIG 1.3.19,
compiled from source code.
I messed around a little on my own and couldn't get things to work
right,
so I copied the examples from the book, nearly verbatim but with some
minor changes to fit my configuration.
I copied the example code exactly into example.i and example.c, and
did
the following commands:
swig -python example.i
gcc -c example.c example_wrap.c -I/usr/include/python2.3
ld -shared example.o example_wrap.o -o _example.so
.... and several other times in the last command I tried some other
things like examplemodule.so and example.so. All of these worked
without
error, so I tried it from within Python, and got the usual error about
"ImportError: dynamic module does not define init function" when I
tried
'import example'. It made no difference if I added the path with all
the
files to sys.path; the same error occurred.
I tried this several times over, and I could never get it to work
right. The last helpful suggestion I saw on here was that I did not
make the init<whatever> function public by putting
/EXPORT:init<whatever> on the linker line, but that doesn't seem to be
what GNU ld understands
Any suggestions?
Thanks,
-Chris