[python-win32] Problem with multiple calls of a DLL

Tim Roberts timr at probo.com
Tue Dec 12 18:44:06 CET 2006

Ola Rylow wrote:
> I know this is not exactly a new question on this list but I have not
> been able to solve my problems by reading old threads.
> I have a dll (MyDLL) from which I want to call some methods. I've
> tried using Ctypes:
> print windll.MyDLL.FirstMethod() 
> print windll.MyDLL.SecondMethod()
> If I run this, SecondMethod fails, but if I switch order FirstMethod
> will fail instead (since it is the second called...).
> The same dll can be used without problems in C++ code.
> So my questions are:
> 1. Does Ctypes have any "FreeLibrary" function?

Are you saying your DLL *requires* that you unload the library between
each call?  That would be a grossly negligent design on the part of the
DLL authors.  Is it possible you simply have the calling sequence
incorrect?  Have you tried "cdll" instead of "windll"?

How does it fail?

Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.

More information about the Python-win32 mailing list