Project

Profile

Help

Bug #4707

closed

Library libsaxonhec.dll is not present in the system (Windows)

Added by O'Neil Delpratt about 4 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Normal
Category:
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

Has duplicate SaxonC - Bug #4953: SaxonCGlue - C/C++ UNICODE Interop - add doc somewhereDuplicate2021-03-30

Actions

Please register to edit this issue

Also available in: Atom PDF