"Arne Vajh?j"<arne@vajhoej.dk> wrote in message
news:4cc2160b$0$23763$14726298@news.sunsite.dk...
On 22-10-2010 03:48, BGB / cr88192 wrote:
JNI and JNA leave a bit to be desired...
having to use pre-existing classes or interfaces to interface Java with
anything else is... lame...
these are not unfixable problems, but thus far the major VM's have not
done
much to improve on them.
even CNI (like GCJ) would be an improvement (just better would be not
having
to use GCJ to use it...).
admittedly, this front is a little awkward...
but, I am left to wonder sometimes if the poor interface mechanisms are
maybe deliberate...
It has certainly had the effect that the usage of JNI is rare.
yes.
Sun devises nearly the worst possible way to interface between C and Java
and standardizes on it as a covert attempt to prevent people from plugging
together C and Java code except in case of dire emergency...
I don't think SUN sees it as a problem.
And many Java developers neither.
OTOH, MS gives us P/Invoke and, better yet, C++/CLI. P/Invoke then
provides
a slightly less awkward way to glue the languages, and C++/CLI allows,
more
so, the ability to write code which sits right on the border...
now, if this would be done without depending on MS's technology or
dealing
with the relatively poorer quality of the existing OSS VM's (and the
apparent issue that C++/CLI is currently specific to MS's VM), this would
be
better.
The MS C++ ability to generate mixed mode code is a very
sophisticated piece of technology.
granted, but little says that it is outside the reach of a corporation with
a pile of developers and money...
FFS I have devised some vaguely similar pieces of technology (actually, more
mixing compiler and interpreter technology, and using dynamic code
generation to glue stuff together, but close enough, directly mixing
bytecode and native code is the next logical step), and I am a lone hobbyist
with neither endless supplies of time nor money. Sun could have probably
done similar much more easily...
after all, they did get the JVM itself working, and looking at it, improving
the FFI would not have likely been anywhere as near a complicated of a task
if they wanted to do so.
Of course SUN could have done it, but it would not have been cheap.