Debugging extension modules

David Bolen db3l at fitlinxx.com
Sat Jul 14 01:18:33 CEST 2001


"Gary Richardson" <garyr at fidalgo.net> writes:

> I have a question regarding the technique of debugging C extension modules.
> I'm using the ActiveState IDE and MSVS 6.0. I place the C code for a module
> in one directory and the Python test code that uses it in another. After
> building the module I copy the DLL to the directory containing the test
> code and try it out. However, if I have to make a change in the C code I
> find that I can't delete or overwrite the DLL file unless I exit the IDE. If
> I start Python from DOS, import the module and do some testing I must exit
> Python before I can delete the DLL. Is there a way to delete the DLL file
> without having to exit the IDE or Python?

I don't believe so.  The python core doesn't actually free the DLL
even if you delete all references to the module, so once you've
accessed it the first time, Python will have done a LoadLibrary() on
the DLL and Windows will consider it in use by the Python process
until Python exits.

You could probably (at least under NT/2K) rename the DLL in order to
rebuild a new version, but I expect you'd still have to stop/start
Python to get it to reload the new version.

--
-- David
-- 
/-----------------------------------------------------------------------\
 \               David Bolen            \   E-mail: db3l at fitlinxx.com  /
  |             FitLinxx, Inc.            \  Phone: (203) 708-5192    |
 /  860 Canal Street, Stamford, CT  06902   \  Fax: (203) 316-5150     \
\-----------------------------------------------------------------------/



More information about the Python-list mailing list