Actions
Bug #4707
closedLibrary libsaxonhec.dll is not present in the system (Windows)
Start date:
2020-09-02
Due date:
% Done:
0%
Estimated time:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Found in version:
1.2.1
Fixed in version:
11.1
SaxonC Languages:
SaxonC Platforms:
SaxonC Architecture:
Description
Reported by user:
When I create my new project I always got error message that library libsaxonhec.dll is not present in the system despite the path was correct and the library was in the appropriate directory.
Finally I found, that the problem is when compiling and define –DUNICODE is present. In this case this makes type mixture between const char* and const wchar_t* in macro LoadLibrary(…). Please see the file SaxonCGlue.c from line 137:
I have changed the code to (see below) and the problem disappeared (I’m running Win7 64bit and IDE is MS Visual Studio 2017):
#if !(defined (__linux__) || (defined (__APPLE__) && defined(__MACH__)))
#ifdef UNICODE
wchar_t* wc = malloc(sizeof(wchar_t)*(strlen(name)+1));
size_t convertedChars = 0;
mbstowcs_s( &convertedChars, wc, strlen(name)+1, name, _TRUNCATE );
HANDLE hDll = LoadLibraryW(wc); // Used for windows only
free(wc);
#else
HANDLE hDll = LoadLibraryA(name); // Used for windows only
#endif
#else
HANDLE hDll = LoadLibraryA(name);
#endif
Related issues
Please register to edit this issue
Actions