On Wed, May 10, 2000 at 11:16:56AM -0700, Matt Welsh wrote:
> No. I want to wrap a *C array* as a Java object - not the other way around.
> What you are talking about is getting a C pointer to a Java object.
> Not the same thing!
Oh, I misunderstood. My apologies. Yes, the reverse would be REALLY
nice. Given Java's bounds checking though, at best it'd have to be
some kind of struct, rather than a raw pointer.
> Also, in the case of Get<PrimitiveType>ArrayElements(), the JVM does not
> promise not to copy the data -- and copying kills your performance.
The JVM has the option of copying or pinning, at it's discretion. This
is actually a good thing, IMHO, because if the array is small enough
copying may be significantly more advantageous than pinning down the
array structure. The interface does let you know if you got a copy or
not so you know if you have to post the update back to the JVM. In
theory at least, the JVM should know the copy/pin performance
tradeoffs better than a developer.
--Chris
PGP signature