Description
I don't know if there is a way to free OpenBLAS if it's used in a DLL, but when I load a DLL that uses OpenBLAS , and then tries to free it, the FreeLibrary function hangs (deadlock?) and never returns.
I use pre-built package downloaded from http://sourceforge.net/projects/openblas/files/v0.2.8/
compiling the test program with Visual Studio 2010.
Here is code to reproduce the issue:
Dummy DLL using OpenBLAS, does nothing:
include "stdafx.h"
include "cblas.h"
BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
return TRUE;
}
void FunctionNeverCalled()
{
float f = 1;
cblas_sasum(1, &f, 1);
}
Program calling the DLL:
include "stdafx.h"
include "Windows.h"
int _tmain(int argc, _TCHAR* argv[])
{
HINSTANCE hInstance = ::LoadLibraryExW(L"..\Debug\DllUsingOpenBlas.dll", NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
::FreeLibrary(hInstance); // Hangs on FreeLibrary
return 0;
}