Using libpurple with Java

Stephen Eilert spedrosa at gmail.com
Wed May 23 17:32:13 EDT 2007


On 5/23/07, Richard Laager <rlaager at wiktel.com> wrote:
> On Wed, 2007-05-23 at 18:45 +0500, M Khalid wrote:
> > Is it possible to use libpurple with Java. I know there is JNI
> > available. But I am wondering if somebody has gone through all the
> > pain of creating header file and compiling libpurple.
>
> I doubt anyone has. I happened to have done some stuff with JNI at one
> point, so I've thought (a little) about how this might work... I have no
> time or desire to actually do this, but I can provide some tips.
>
> If I was going to do this, I'd first see if there was something more
> automatic. If not, then I'd create Java classes for all the public
> libpurple APIs I wanted to wrap (e.g. PurpleBuddy). I'd have public
> methods (that made it look as if everything was implemented in Java),
> then have those call private native methods, which I'd implement in a
> thin glue layer around libpurple. You would want to use a class
> initializer to load libpurple.so, probably by way of some indirect class
> (PurpleBuddy uses some protected PurpleImpl factory class that loads
> libpurple.so once from its class initializer).

I have not tested it. However, I believe SWIG can generate the
required JNI "glue".

http://www.swig.org/


--Stephen


programmer, n:
        A red eyed, mumbling mammal capable of conversing with
inanimate monsters.




More information about the Devel mailing list