Hi I have an ATL based COM plugin and there is another 3rd party library that I want to use. It's not COM dll and implemented in C++.
details on 3rd party dll as follows:
Configuration type = Dynamic Library(.dll)
Use of MFC = Use MFC in a static library
Use of ATL = not using ATL
Character set = use multi-btye char set
CRL support=no clr support
details on COM dll project as follows:
Configuration type = Dynamic Library(.dll)
Use of MFC = Use MFC in a shared library
Use of ATL = dynamic link to ATL
Character set = use unicode char set
CRL support=no clr support
This is my code
HRESULT FinalConstruct()
{
LPCWSTR libPath = _T("LicEnf.dll") ;
const char * clibPath = "LicEnf.dll" ;
SetLastError(0);
HMODULE hMod = LoadLibraryA(clibPath);
if(hMod==NULL)
{
LOG4CXX_TRACE(CALMLogger::GetModuleLogger(ModuleName),
_T("Could not load library:GetLastError() returned ") << GetLastError());
}
return S_OK;
}
FinalConstruct is called 3times. hMod always 0 and on the log file i have
Could not load library:GetLastError() returned 183
Could not load library:GetLastError() returned 126
Could not load library:GetLastError() returned 126
where
-183 (0xB7) =ERROR_ALREADY_EXISTS
-126 (0x7E) =ERROR_MOD_NOT_FOUND
On the other hand if I call this code from another test application which is an ordinary exe file , loadLibrary works fine. Is there any limitation of loading a native win32 dll from COM-dll and what's my mistake here ?
Thanks