Ive recently had troubles using swig in clojure getting a 'unsatisfied
link exception' even though using the swig generated library worked in
regular java code. I believe there was a post on this somewhere in
these google groups.

Anyways, I have figured out that if I place the following code in a
clojure file (test.clj)
(System/loadLibrary "Seth")

and go (compile 'test) on the REPL, i get


No such file or directory
  [Thrown class java.io.IOException]

Restarts:
 0: [QUIT] Quit to the SLIME top level

Backtrace:
  0: java.io.UnixFileSystem.createFileExclusively(Native Method)
  1: java.io.File.createNewFile(File.java:900)
  2: clojure.lang.Compiler.writeClassFile(Compiler.java:5885)
  3: clojure.lang.Compiler.compile(Compiler.java:6043)
  4: clojure.lang.RT.compile(RT.java:368)
  5: clojure.lang.RT.load(RT.java:407)
  6: clojure.lang.RT.load(RT.java:381)
  7: clojure.core$load$fn__4511.invoke(core.clj:4905)
  8: clojure.core$load.doInvoke(core.clj:4904)
  9: clojure.lang.RestFn.invoke(RestFn.java:409)
 --more--




However, afterwards i can succesfully do
(import Seth)
(Seth/add 2 3) => 5

I cant do the loadlibrary thing on the repl, or it wont work (i get
the 'unsatisfied link error' when calling (Seth/add)).  Notice that if
I do (compile 'test) again i get the same error above, which is
weird because if i do (System/loadLibrary "Seth") on the repl i get
the 'expected' error

Native Library /home/seth/.random/java/libSeth.so already loaded in
another classloader
  [Thrown class java.lang.UnsatisfiedLinkError]

Restarts:
 0: [QUIT] Quit to the SLIME top level

Backtrace:
  0: java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1715)
  1: java.lang.ClassLoader.loadLibrary(ClassLoader.java:1675)
  2: java.lang.Runtime.loadLibrary0(Runtime.java:840)
  3: java.lang.System.loadLibrary(System.java:1047)
  4: user$eval1825.invoke(NO_SOURCE_FILE:1)
  5: clojure.lang.Compiler.eval(Compiler.java:5424)
  6: clojure.lang.Compiler.eval(Compiler.java:5391)
  7: clojure.core$eval.invoke(core.clj:2382)
 --more--




Anyone know whats going on and how this can be fixed?

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to