[python-win32] loading and unloading python24.dll in an embedded situation

Michael L Torrie torriem at chem.byu.edu
Thu Sep 28 19:08:18 CEST 2006


I have a problem with an embedded application that loads python24.dll.
Basically my embedded application is itself a dll that is a plugin for
another application.  my dll is loaded and unloaded on demand.  I do
have my dllmain stuff initialize and finalize python when appropriate.
This works most of the time.  The problem is that if python loads any
modules that use dlls, such as win32gui, when my dll is unloaded the
pywintypes.dll does not get unloaded (neither does python24.dll for that
matter).  Having python24.dll sticking around doesn't seem to be a
problem, but unfortunately the pywintypes.dll is a problem.  When my dll
is loaded the second time, something fails (probably when pywintypes.dll
is asked to initialize again).  

So my question is, is there any way to get these dlls unloaded?  

If not, I guess I'll have to resort to putting python in a separate
process and communicating with it via an IPC mechanism, which is not
something I want to do.

thanks.

Michael




More information about the Python-win32 mailing list