This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: CNI for C


On Wed, 2004-04-07 at 13:13, Andrew Haley wrote:
> 
> Yes, that's what libffi does.

Ahh, I couldn't remember the name ;)

<SNIP>
> Well, the nice thing about pinvoke as far as I can see is that you
> don't have to write anything: you can just call native DLLs directly.
> It's harder to do this in the general case of ISO C, because there
> aren't necessarily Java equivalents of the C types used to access
> DLLs.  However, in many cases, and this possibly includes all the
> platforms we care about, there are.

Well, surely you could (un)box value types fairly easily. In terms of
structures, how does libffi handle them? If you know you have a
structure called 'Point' and it has 'x' and 'y' as fields, and libffi
knows this, then you could potentially do something using reflection
(attempt to match types and then do conversion)

Using JNI to do pinvoke only means you have to worry about that single
function - everything else can use pure java types to generate what it
needs - You might construct a MethodReference that holds all the
necessary information or something. It sounds like it would be fairly
neat, and might make people a lot more willing to use Java.

-- 
Andrew Shuttlewood <andrew.shuttlewood@futureroute.co.uk>
Futureroute


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]