Derek L Davies
ddavies at world.std.com
Mon Feb 7 10:14:44 PST 2000
I'm trying to figure out the right way to implement the interface for
JVMDI, but I'm confused about the goals and benefits of interface
pointers as given in the JNI spec and the examples given in the JVMDI
spec and on other random web sites. The JVMDI spec has a "draft
quality" feel compared with the JNI spec and I'm not sure how
literally to interpret it.
So the question is "Do I implement an interface analogous to JavaVM and
JNIEnv or do I implement the Sun JVMDI spec 'exactly' as given?"
The JVMDI spec gives an example of obtaining the the JVMDI interface
pointer, but stops short of showing an actual JVMDI function call.
They also do not include the interface pointer as the first argument
to interface functions.
However, the "codeguru" web site
(roughly) this example:
(*jvm)->GetEnv(jvm, &jvmdi, JVMDI_VERSION_1);
I wonder why the JVMDI call isn't done like this:
so that the benefits of having an interface pointer are realized for
JVMDI as they are for JNIEnv and JavaVM? Briefly, the benefits as I
understand them are: COM compatibility, C++ compatitbility, lack of
dependancy on vendor specific library name, Multiple implementations
of an interface, and interface versioning.
It seems like the "codeguru" example is broken to me. Does anyone
know if this is a legal example? I don't have sun's implementation
and am going to great lengths to avoid getting it. I don't want to
look at any of their code, including their implementation of
"jvmdi.h". Does anyone have an example of calling a JVMDI function
that works with the sun code?
Also, does anyone know why the forth function table entry is reserved
in the JNIEnv interface pointer? I understand the first three are
reserved for MS COM compatibility, but why the fourth? Should I
reserve the forth JVMDI_Interface_1 function table slot?
One last nitpicky thing: I came across some "KNI" code. What's KNI
and how does it differ from JNI? Is this for Kaffe specific
extensions to JNI? Is there a reason to have a KVMDI? Is this stupid
to worry about at this point?
Thanks in advance for comments!!
More information about the kaffe