Pidgin Query

Jeff Sadowski jeff.sadowski at gmail.com
Wed Aug 1 19:19:24 EDT 2007


here is a demonstration of using jna :-)

wget https://jna.dev.java.net/source/browse/*checkout*/jna/trunk/jnalib/dist/jna.jar
cat << END > hello.c
int hello()
{
 return 5;
}
END
gcc -shared -o libhello.so hello.c
PWD=`pwd`
export CLASSPATH=.:jna.jar
cat << END > hellow.java
import com.sun.jna.*;
import java.util.*;
class hellow
{
 String oldclasspath = System.setProperty("java.class.path","$PWD");
 public interface helloworld extends Library {
 int hello();
 }
 public static void main(String[] args)
 {
 String oldjnalibpath = System.setProperty("jna.library.path","$PWD");
 helloworld lib = (helloworld)Native.loadLibrary("hello",helloworld.class);
 System.out.println(lib.hello());
 }
}
END
javac hellow.java
java hellow


On 8/1/07, Sascha Vogt <FunkyFish at gmx.net> wrote:
> Hi,
>
> Peter Ruibal schrieb:
> > On 8/1/07, *Jeff Sadowski* <jeff.sadowski at gmail.com
> > <mailto:jeff.sadowski at gmail.com>> wrote:
> >     Yesterday when I was trying to figure out how to use shared
> >     object libs in java
> > For anyone who's interested, you can use jna ( http://jna.dev.java.net
> > <http://jna.dev.java.net/>) or jni (
> > http://java.sun.com/j2se/1.5.0/docs/guide/jni/spec/jniTOC.html) to
> > directly interface java with c libraries directly.
> Oh, I did not yet recognize JNA, that looks interesting. I'd like to
> have Java-bindings for libpurple and thought of SWIG[0] to create the
> JNI-Code. But I do not have much experience in C.
> Maybe I'll simply try it out, after I have a little more time (writing
> master thesis, moving house, ...).
>
> I'll post as soon as I have sth presentable.
>
> Greetings
> -Sascha-
>
> [0]http://www.swig.org
>
> _______________________________________________
> Devel mailing list
> Devel at pidgin.im
> http://pidgin.im/cgi-bin/mailman/listinfo/devel
>




More information about the Devel mailing list