On Tue, Sep 29, 2009 at 10:26 AM, John Cowan <[email protected]> wrote:
>
> A serious Java FFI has to give access to at least:
>
>        public static methods
>        public static fields
>        public instance methods
>        public instance fields
>        constructors
>        arrays (construct, select, mutate)
>        instanceof
>        exception throwing
>        exception catching
>
> Only the first two have C counterparts.

Calling a static method vs. an instance method is the difference
between a CDECL and a `thiscall'.  It's just a calling convention.
Constructors are specially named methods.  You don't call them
very differently from static methods.

Fields are not foreign `functions', so there isn't a need to transfer
control (unless you are using reflection, in which case field access
is in fact a method).  You do need to understand the data layout
(which is what the metadata tells you).

Arrays and instanceof are similarly dealt with.


Callbacks are when it starts getting interesting because you
have to program the foreign language's FFI, which may not be
particularly easy.  Exceptions will be a similar issue because
both callbacks and exceptions involve non-standard transfer
of control from the foreign language back into Scheme.


-- 
~jrm

_______________________________________________
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss

Reply via email to