With the relatively recent release of clojure 1.0.0, I decided to give
another try to using SWIG-generated native libraries with it.
It still doesn't work on my box: I get an "UnsatisfiedLinkError"
exception when trying to call a native function. Still, calling the
function from plain Java code works as expected.

To demonstrate it I packed up a folder with a minimal, reproducible
example:
http://clojure.googlegroups.com/web/SWIGTest.tar.bz2
The archive file size is so small I included sources & compiled files
too (shared library compiled for Linux-i386 machines). A "compile.sh"
shell script is included as a guidance if you want to compile it all
yourself. Run the .clj script and you should get the aforementioned
exception. Run the plain java app. by:
$ java SwigTest
from the root folder and you should get the number "3" printed on
screen.

I would appreciate any comment about the issue.

Thanks for the great work,
all the bests,
Antonio, Fabio Di Narzo.

On Apr 29, 12:42 pm, "Antonio, Fabio Di Narzo"
<antonio.fa...@gmail.com> wrote:
> 2009/4/29 Tony Hursh <tony.hu...@gmail.com>:
>
>
>
>
>
> > On Apr 27, 2009, at 8:45 PM, jim wrote:
>
> >> Hey Antonio,
>
> >> I'm getting a similar error. I wanted to call setuid from Clojure, so
> >> I followed this link's example:
> >>http://www2.sys-con.com/itsg/virtualcd/Java/archives/0510/Silverman/i...
>
> >> to build a java class and a shared library. I added the class to my
> >> classpath and was able to import my UID class. But when I tried to
> >> call the UID.setuid method, it gave me that UnsatisfiedLinkError. Did
> >> you find a solution to your problem?
>
> >> Jim
>
> >> On Apr 22, 8:41 am, "Antonio, Fabio Di Narzo"
> >> <antonio.fa...@gmail.com> wrote:
> >>> Hi all.
> >>> I'm having problems with usingswig-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.
>
> > (snip)
>
> > Not a direct solution for whatever's going wrong with The Horror That
> > IsSWIG,
>
> Sure, theSWIGC file is unreadable, and very far from an hypothetical
> handwritten C wrapper. However, I would underline that it works
> smoothly in the Java language, and only gives problems with Clojure.
>
> I'm also wondering now if the problem is restricted to my linux
> platform, or is more general (win, mac, different JDKs, etc.).
>
> >but have you guys tried using JNA instead?
>
> I'm working with already existent (SWIG-based) libraries. I'll
> consider JNA for the future. Tnx for the tip.
>
> a.
>
>
>
> > IIRC, the JRuby folks managed to get the entire POSIX library working
> > through JNA, and I think I've seen mention of a similar success with
> > the Win32API.
>
> --
> Antonio, Fabio Di Narzo
> Ph.D. student at
> Department of Statistical Sciences
> University of Bologna, Italy
--~--~---------~--~----~------------~-------~--~----~
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