Thank you for the suggestion, but doesn't help.
Note again that I use it with no problems with plain java:
---file:SwigTest.java---
import  swig_test.swig_test;
public class SwigTest {
    public static void main(String[] args) {
        System.load(System.getProperty("user.dir") +  "/libswig_test.so");
        System.out.println(swig_test.swig_test_whatever());
    }
}
---cut---
gives:
$ java SwigTest
3

as expected.

On Apr 22, 9:18 pm, "Dimiter \"malkia\" Stanev" <mal...@gmail.com>
wrote:
> I might be wrong,
>
> but shouldn't you compile the .c file to .o with "-fpic", and then
> link with ld with "-shared"?
>
> maybe just adding "-fpic" to:
>
> gcc -fpic -shared ${JNI_CFLAGS} swig_test_wrap.c -o libswig_test.so
>
> might do it.
>
> On Apr 22, 6:41 am, "Antonio, Fabio Di Narzo"
>
> <antonio.fa...@gmail.com> wrote:
> > Hi all.
> > I'm having problems with using swig-generated wrappers with Clojure.
> > I'm running ubuntu-8.04-i386, gcc-4.2.4, swig-1.3.33, openjdk-1.6.0,
> > latest clojure release.
>
> > I've cut down a minimal reproducible example.
> > The swig file:
> > ---file:swig_test.i---
> > %module swig_test
> > %{
> > int swig_test_whatever() {
> >   return 3;}
>
> > %}
> > int swig_test_whatever();
> > ---cut---
>
> > Compile with:
> > ---cut---
> > mkdir swig_test
> > swig -java -package swig_test -outdir swig_test swig_test.i
> > javac swig_test/*.java
> > export JAVA_HOME=/usr/lib/jvm/java-6-openjdk
> > export JNI_CFLAGS="-I${JAVA_HOME}/include -I${JAVA_HOME}/include/
> > linux"
> > gcc -shared ${JNI_CFLAGS} swig_test_wrap.c -o libswig_test.so
> > ---cut---
>
> > The swig-generated java itfc file is:
> > ---file:swig_test/swig_test.java---
> > package swig_test;
> > public class swig_test {
> >   public static int swig_test_whatever() {
> >     return swig_testJNI.swig_test_whatever();
> >   }}
>
> > ---cut---
>
> > The clojure code:
> > ---cut---
> > (import '(swig_test swig_test))
>
> > (System/load
> >  (.concat (System/getProperty "user.dir") "/libswig_test.so"))
> > (swig_test/swig_test_whatever)
> > ---cut---
> > I get:
> > java.lang.UnsatisfiedLinkError:
> > swig_test.swig_testJNI.swig_test_whatever()I (NO_SOURCE_FILE:0)
>
> > I can use "manually written" JNI wrappers with clojure and, vice-
> > versa, swig-generated wrappers with plain java code. What I'm missing
> > here? Anybody can help?
>
> > Bests,
> > Antonio, Fabio Di Narzo.
--~--~---------~--~----~------------~-------~--~----~
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
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