Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

c++ byte[] to jbytearray

843829Jul 3 2006 — edited Jul 12 2006
hi, in the c++ code I have a byte array, I need to convert it to jbytearray and call a java method from there.

I'm using this code but the compiler complains about conversions (of course)

jbyteArray jarray = env->NewByteArray(pAdapter->AddressLength);
env->SetByteArrayRegion(jarray, 0, pAdapter->AddressLength, pAdapter->Address);
env->CallVoidMethod(NetDataClassObject, setAddress, jarray);

SetByteArrayRegion' : cannot convert parameter 4 from 'unsigned char [8]' to 'const signed char *'

if I cast pAdapter->Address with (const signed char*) in java I get weirds characters...

here the reference to c++ structs
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iphlp/iphlp/ip_addr_string.asp

Any help? Thanks for attention,
Alessandro
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 9 2006
Added on Jul 3 2006
2 comments
2,216 views