On Windows I have a DLL that we made ourselves which among other loads another DLL. The problem is that when using the DLL in Matlab with loadlibrary, calllib and unloadlibrary everything is fine.
In Python I tried to use ctypes and cffi, both with same results. I can load the DLL and call functions, but I cannot exit again. Python hangs, and I have to end the task from the Task Manager.
With ctypes I have tried to call
import _ctypes
_ctypes.FreeLibrary(lib._handle)
as suggested here Free the opened ctypes library in Python with no effect. Further, I tried to call explicit function to unload the other DLL.
Can anyone give a hint or solution to why it will not unload/hangs?