12 messages in net.java.dev.jna.usersRe: [jna-users] Re: Requiring Library...
FromSent OnAttachments
Charles Oliver NutterSep 4, 2007 8:36 am 
Timothy WallSep 4, 2007 9:01 am 
Charles Oliver NutterSep 4, 2007 9:50 am 
Timothy WallSep 4, 2007 10:29 am 
Charles Oliver NutterSep 4, 2007 12:59 pm 
Wayne MeissnerSep 4, 2007 7:13 pm 
Philip JenveySep 4, 2007 9:38 pm 
Wayne MeissnerSep 4, 2007 10:01 pm 
Charles Oliver NutterSep 4, 2007 10:40 pm 
Wayne MeissnerSep 4, 2007 11:41 pm 
Charles Oliver NutterSep 5, 2007 12:04 am 
Timothy WallSep 5, 2007 5:45 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [jna-users] Re: Requiring Library superinterface?Actions...
From:Charles Oliver Nutter (char@sun.com)
Date:Sep 4, 2007 10:40:29 pm
List:net.java.dev.jna.users

Wayne Meissner wrote:

Hmm. Given that JRuby already uses asm, it could use this approach + an asm generated subclass that includes the Library interface if it is available at runtime.

Its a lot simpler if JNA just drops the requirement that the passed in class doesn't extends Library, assuming that doesn't break anything.

The real question is, why are you guys doing this in java, instead of directly in ruby or python code?

Well, there is a bit of Java code yet in JRuby and Jython :) In general, the reason I'm using JNA is to provide core class methods like File#chmod for example. File, being a core class, is implemented entirely in Java...and so it's simplest if I just have a normal Java method on a normal Java interface I can call to chmod for it. Since there are at least three ways to implement chmod right now (shelling out, using Java 6 permission APIs, or using JNA), I want to put them behind an interface and select them based on availability of libraries or APIs. That means using a single interface.

Philip's suggestion unfortunately doesn't help me produce a compilable JRuby that doesn't directly reference JNA, since the JNAPosix still requires JNA to be present and I don't want to have conditional builds for "with JNA" and "without JNA". I want to be able to drop JNA into a lib dir and have JRuby start using it, or work using the kludgy implementations when JNA isn't available.

I agree that removing the "extends Library" requirement would be easiest. Make JNA do the magic :)

- Charlie