[issue14597] Cannot unload dll in ctypes until script exits

2012-04-16 Thread Pat Lynch
Pat Lynch added the comment: Just to update:- I've run this pretty extensively on multiple systems (XP x86 & Win7 64-bit) and it appears to behave as expected (haven't checked it on Linux). I have that code being called in 100s of unit tests. For python 3.1, would it make sens

[issue14597] Cannot unload dll in ctypes until script exits

2012-04-16 Thread Pat Lynch
Pat Lynch added the comment: ok, that's fair enough if most usage of ctypes is from people accessing system libraries :) I wouldn't have thought my usage was that weird though (given the strength of using python for unit testing). In local tests, adding a function CDLL::ForceUnloadD

[issue14597] Cannot unload dll in ctypes until script exits

2012-04-16 Thread Pat Lynch
Pat Lynch added the comment: thanks for the very quick response. Since LoadLibrary is called in the constructor, why can't FreeLibrary be called in the destructor? or at least expose a function to unload that calls FreeLibrary? http://msdn.microsoft.com/en-us/library/windows/desktop/ms6

[issue14597] Cannot unload dll in ctypes until script exits

2012-04-16 Thread Pat Lynch
Pat Lynch added the comment: I should mention also, that this is mostly an issue for me on Win7 x64. It does behave 'slightly' better on WinXP x86. (I have the 64-bit version of python installed on Win7 x64 & the 32-bit version installed on WinXP) thanks, Pat. On 16 April 2

[issue14597] Cannot unload dll in ctypes until script exits

2012-04-16 Thread Pat Lynch
New submission from Pat Lynch : If I load a dll in ctypes, then delete that loaded DLL instance, the DLL is not unloaded until the script finishes and exits. I'm trying to write some unit tests in python to exercise that DLL where each test case loads a DLL, does some work, then unload