CFFI on Windows does not load sqlite3.dll
Hello, This is on Windows 10, Armed Bear Common Lisp 1.4.0, Java 1.7.0_51 Oracle Corporation I am trying to link to sqlite3.dll with CFFI (as required by the cl-dbi package) I have jna installed in my home directory under ~/.m2/... and cffi loads cleanly as does cl-dbi. Note that the ~/.m2/.../jna-4.2.2.jar is not in my classpath. Instead I added it via (java:add-to-classpath ...) (cffi:load-foreign-library "c:/Program Files/sqlite/sqlite3.dll") gives an error (shown below). I also tried by adding the directory to cffi:*foreign-library-directoris*, and then calling (cffi:load-foreign-library "sqlite3.dll"). The error message is: Unable to load foreign library (SQLITE3.DLL-30929). Unable to load library 'C:/Program Files/sqlite/sqlite3.dll': Native library (win32-x86/C:/Program Files/sqlite/sqlite3.dll) not found in resource path ([file:/C:/mv-program-files/abcl-bin-1.4.0/, file:/C:/mv-program-files/abcl-bin-1.4.0/abcl.jar]) Questions: 1. What is the implication of the win32-x86 prefix to the path in the error message? Is that a 32/64 bit incompatibility? 2. I don't understand the part of the error message referring to the resource path 3. while CFFI does compile, do I have somehow to load JNA explicitly. In other words, is (ql:qload ...) enough, or do I need to do something else to activate JNA? 4. Does CFFI work on Windows (since Java is cross-platform, I would expect it to)? (My Java knowledge is epsilon where epsilon appraches 0, although I plan to work on this if I continue using ABCL to interface to Java libraries) Thank you, Mirko
Hello Mirko, On Mon, Apr 24, 2017 at 4:05 AM, Mirko Vukovic <mirko.vukovic@gmail.com> wrote:
Unable to load library 'C:/Program Files/sqlite/sqlite3.dll': Native library (win32-x86/C:/Program Files/sqlite/sqlite3.dll) not found in resource path ([file:/C:/mv-program-files/abcl-bin-1.4.0/, file:/C:/mv-program-files/abcl-bin-1.4.0/abcl.jar])
Kind of looks like "C:/Program Files/sqlite/sqlite3.dll" is being interpreted as the library name rather than a path. I have a couple of random, independent ideas: 1. Replace forward slashes with backward slashes: "C:\\Program Files\\sqlite\\sqlite3.dll". 2. Place the DLL (and its dependencies) somewhere in the PATH and try (cffi:load-foreign-library "sqlite3.dll") 3. <http://stackoverflow.com/questions/25063614/jna-set-resource-path> Hope that helps, -- Luís Oliveira http://kerno.org/~luis/
I think the issue was a 32 vs 64-bit mismatch. My sqlite3.dll is a 64-bit library. I just downloaded the 32-bit version of sqlite3.dll and CFFI did link to it (did not issue any errors). I will continue with testing. My reading of java -version implies that my java is 32-bit:
java.exe" -version java version "1.7.0_51" Java(TM) SE Runtime Environment (build 1.7.0_51-b13) Java HotSpot(TM) Client VM (build 24.51-b03, mixed mode, sharing)
On Mon, Apr 24, 2017 at 6:24 AM Luís Oliveira <luismbo@gmail.com> wrote:
Hello Mirko,
On Mon, Apr 24, 2017 at 4:05 AM, Mirko Vukovic <mirko.vukovic@gmail.com> wrote:
Unable to load library 'C:/Program Files/sqlite/sqlite3.dll': Native library (win32-x86/C:/Program Files/sqlite/sqlite3.dll) not found in resource path ([file:/C:/mv-program-files/abcl-bin-1.4.0/, file:/C:/mv-program-files/abcl-bin-1.4.0/abcl.jar])
Kind of looks like "C:/Program Files/sqlite/sqlite3.dll" is being interpreted as the library name rather than a path. I have a couple of random, independent ideas:
1. Replace forward slashes with backward slashes: "C:\\Program Files\\sqlite\\sqlite3.dll". 2. Place the DLL (and its dependencies) somewhere in the PATH and try (cffi:load-foreign-library "sqlite3.dll") 3. <http://stackoverflow.com/questions/25063614/jna-set-resource-path>
Hope that helps,
-- Luís Oliveira http://kerno.org/~luis/
participants (2)
-
Luís Oliveira
-
Mirko Vukovic