Hi there
I've got some code here for which I've been building some python hooks
as a first step towards implementing new interface for the old code.
This code is an equation solver program (called ascend), and part of
what it does is to compile C-code for mathematical equations so that
they can quickly evaluated at native machine speeds. This means that a C
source file is generated and then compiled and dlopened then using
dlsym, then an 'initialisation' routine is run to load the symbols for
functions which evaluate the equations in the source code.
My problem -- and I'm not sure if it's a linking problem, or a SWIG
problem, or a python problem -- is that when I compile my C++ 'hook
classes' and call them from a C++ main() function, they work as expected
(the main() program creates some equations, compiles them into a
temporary shared library (.so file), dlopens it and loads a symbol for
the 'initialisation' routine using dlsym), but when I compile my hooks
into a shared object and load it from python, the temporary shared
library won't load.
The temporary shared library contains a symbol which is present in the
main executable (ie from my main() function). This symbol is also
present in my _ascend.so python library. I think that what is happening
is that when my dlopen call is made, and there is found to be an
undefined symbol (a function contained in the main ascend code, being
called from the 'initialisation' routine), dlopen is looking in the
symbol table for the currently-running executable to try to resolve the
undefined symbol. In the case of the main() program, that symbol is
found. In the case using using the SWIG library from python, the symbol
is not found, because *python* is the running executable, and the symbol
is in my _ascend.so, not in the python executable.
Is this a limitation of dlopen? Can I not perform 'cascading' dlopens?
How can I work around it so that my library compiled for python using
SWIG can perform dlopens of its own, which resolve undefined symbols
back in my python/SWIG library?
Any suggestions much appreciated,
Cheers
JP
--
John Pye
School of Mechanical and Manufacturing Engineering
The University of New South Wales
Sydney NSW 2052 Australia
t +61 2 9385 5127
f +61 2 9663 1222
mailto:john.pye_AT_student_DOT_unsw.edu.au
http://pye.dyndns.org/-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP. Click here to play:
http://sourceforge.net/geronimo.php_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user