Re: Problem extending python through dynamic loading
Tue, 12 Apr 94 09:56:55 EDT

I wish I had looked at this yesterday Sim, because you
definitely do NOT want to link your shared object code in with the
Python libraries!! Those are already running around in memory when
you're module gets loaded and they get 'dynamically' linked in at
run-time. So having them already present in your shared object code
caused clashes. I don't know if this will solve all of your problems,
but try taking $(LIB) out of that ld command see if that helps!

Simeon H. Fitch writes:
| I am currently writing a module that implements a new class in Python,
| but instead of compiling it into Python I want it to be dynamically
| loaded at run-time. I am working on a Sun Sparc10 using g++ to
| compile my module code and ld to create my dynamic object file. If my
| module consists of only one file, i.e. one .C file to one .o file, I
| have _no_ problem loading it into python at run-time. However, if I do
| something like:
| ld $(LIB) -o object1.o object2.o
| (where LIB has all the python libraries needed, like libObjects.a, etc.)
| causes (from inside Python) to give me the error:
| Undefined symbol: ___builtin_new
| If I do:
| nm -u
| no unresolved names are reported.
| I searched through all of the Python libraries for a definition of
| _builtin_new but found nothing like that. The interesting thing is
| that if you actually search through the .so file (through all the hex
| munge), __builtin_new comes up in the two object file case, but not in
| the single object file case.
| I have burned about 8 hrs on this problem and am running out of things
| to try. The intelligent thing for me to have done would be to have
| asked one of you if it is at all to do this, but I kept learning cool
| things about python and dynamic objects. :-)
| So, any relevant anecdotes that you might have about your experience with
| dynamic loading in Python would be greatly apprieciated.
| Thanks!
| -Simeon-
| --
| +---------------------------------------------------------------------+
| | Simeon H. Fitch Department of Computer Science |
| | fitch@Virginia.EDU University of Virginia |
| +---------------------------------------------------------------------+
| Johann Gambolputty de von Ausfernschplenden schlitter crascrendon
| fried digger dingle dangle dongle dungle burstein von knacker thrasher
| apple banger horowitz ticolensic grander knotty spelltinkle grandlich
| grumblemeyer speltwasser kurstlich himbleeison bahnwagen gutenabend
| bitte ein nurnburger bratwustle gerspurten mitz weimache luber
| hundsfut gumberaber schvnendanker kalbsfleisch mittler aucher von
| Hautkopft of Ulm

-------> Tommy.

"Subvert the parental paradigm - Refuse Birth."