[Pythonmac-SIG] Reloading C extension modules ??

Jack Jansen jack@oratrix.nl
Thu, 20 Apr 2000 23:21:30 +0200

Recently, "Louis M. Pecora" <pecora@anvil.nrl.navy.mil> said:
> Anyone know anything about reloading C extensions?  I am successful at writin
> g one, but when I change the C code and recompile to make a share lib module,
>  the reload command does NOT put the new one into Python.  I'm stuck with the
>  old one until I quit Python, launch it again and re-import everything again.
>  Bummer for developing an extension.

This is definitely doable, but it would require a lot of work: the old 
dll has to be unloaded (which needs code in probably importdl.c) and
also a different CodeWarrior runtime library should be used (the
DropIn one in stead of the SharedLib one, if I remember correctly).

I don't have any time to spend on this, but if anyone else wants to
implement this I'll incorporate it.

But, on a tangent, if my extension is so complicated it needs
debugging I usually debug it by incorporating it into
PythonStandSmall. The CodeWarrior debugger always seems to work better 
for me if I use it on a statically linked program in stead of on a plugin.
Jack Jansen             | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++
www.oratrix.nl/~jack    | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm