Thank you.
You might be interested in the following code snippet:
// first we retrieve the path of wcl DLL.
if (!GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
(LPCSTR) &_some_function_from_wcl_dll_, &hmod))
{
throw new exception ("GetModuleHandle failed");
}
DWORD dwLen = GetModuleFileName(hmod, szPath, MAX_PATH);
// build path for wcl2wbt dll based on wcl.dll path.
wstring s = szPath;
wstring path = s.substr(0, s.find_last_of ('\\') + 1);
wstring wcl2wbtdllpath = path + L"wcl2wbt.dll";
// now we load the wcl2wbt dll
mWCL2WBT = LoadLibrary (wcl2wbtdllpath.c_str());
With this code, the wcl dll will always find the wcl2wbt.dll if it is in the same directory as wcl.dll, whatever that directory is and regardless of how wcl.dll is loaded (with default search path or explicit path). If this fails, you can always fall back to loading it without absolute path, of course.