Project

Profile

Help

right way to use setProperty("extc", filePath) on Windows with C++?

Added by Martin Honnen about 2 years ago

I have also tried my luck getting a C++ extension function to run with Windows 10 and SaxonC EE 11.2, but I don't know which format to use for the extc property file path, the path executable->setProperty("extc", "C:/Program Files/Saxonica/SaxonC EE 11.2/samples/cppTests/cppExtensionFunction"); gives the error

Test: TransformToStringExtensionFunc:
Native code library failed to load. /C:/Program Files/Saxonica/SaxonC EE 11.2/samples/cppTests/cppExtensionFunction.dll
java.lang.UnsatisfiedLinkError: Can't load library: /C:/Program Files/Saxonica/SaxonC EE 11.2/samples/cppTests/cppExtensionFunction.dll

the path executable->setProperty("extc", "C:\\Program Files\\Saxonica\\SaxonC EE 11.2\\samples\\cppTests\\cppExtensionFunction"); gives the result

Test: TransformToStringExtensionFunc:
Native code library failed to load. /C:\Program Files\Saxonica\SaxonC EE 11.2\samples\cppTests\cppExtensionFunction.dll
java.lang.UnsatisfiedLinkError: Can't load library: /C:\Program Files\Saxonica\SaxonC EE 11.2\samples\cppTests\cppExtensionFunction.dll

Where is that leading slash / included, in the SaxonC code or in SaxonC->SaxonJ glue code?

What is the proper way to set a path for Windows so that the library can be found?


Replies (2)

RE: right way to use setProperty("extc", filePath) on Windows with C++? - Added by O'Neil Delpratt about 2 years ago

This is a bug in the Java code. Unfortunately this needs a rebuild of the SaxonC library. A possible workaround is to write in the C++ API the JNI code to use the underlying method below. The user here can set the working directory:

SaxonCAPI.setLibrary(String cwd, String libName)

Reported this as bug issue here: #5344

RE: right way to use setProperty("extc", filePath) on Windows with C++? - Added by O'Neil Delpratt about 2 years ago

I possible workaround is to set the cwd in the C++ API . This should avoid the leading slash / .

    (1-2/2)

    Please register to reply