Re: object serialisation
"BGB" <cr88192@hotmail.com> wrote in message
news:icmdcg$mdr$1@news.albasani.net...
part of the reason though is I am not really intending to use it for
self-contained apps, but more for app scripting. so it matters more that
the Java<->C interface is good than that the runtime doesn't suck
(sadly... I am still mostly using JNI for a lot of this...).
If you're rolling your own, how about this? Create a utility that
generates a C header file for a specified class, defining it as a C struct,
and when your JVM calls into C, pass a pointer to that struct instead of an
opaque pointer. Your C can now access everything in the class directly
instead of having to use JNI. (Having the header define function pointers
used to call the class's methods would be a further step.) You lose Java's
safety guarantees [1], which are the main reason that JNI is so clumsy, but
to offset that, you have huge gains in efficiency and ease.
1. That is, you gain C's full freedom to scribble all over random bits of
memory.