I'm trying to use Clojure to call a library via JNI. Here's a working
piece of Java code that I'm trying to convert to Clojure:
import libfoo.Foo; // A GlueGen-generated wrapper
class Test {
static {
System.loadLibrary("foo"); // The original library
System.loadLibrary("foojni"); // A GlueGen-generated wrapper
}
public static void main(String[] args) {
Foo.do_nothing();
}
}
Here's my Clojure conversion:
(import '(libfoo Foo))
(System/loadLibrary "foo")
(System/loadLibrary "foojni")
(Foo/do_nothing)
Running this Clojure program results in:
java.lang.UnsatisfiedLinkError: libfoo.Foo.do_nothing()V
(test.clj:0)
as if the library wasn't dynamically linked at all.
The Clojure code works if I copy the static block from my Java client
code into the GlueGen generated Java class, and remove the
System/loadLibrary calls from the Clojure client.
If the libraries are loaded in the static block of the Java wrapper
class, calling System/loadLibrary in Clojure results in:
java.lang.UnsatisfiedLinkError: Native Library <snip>/libfoo.so
already loaded in another classloader (test.clj:0)
Is there a working equivalent of System.loadLibrary() in the Clojure
API? I tried to google for it, but couldn't find anything.
Thanks,
--
Timo
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---