logo       

Java and Arrays: msg#00112

programming.swig

Subject: Java and Arrays

Hello


SWIG will produce code like this, when using "arrays_java.i":

/* signed char[] support */
int SWIG_JavaArrayInSchar (JNIEnv *jenv, jbyte **jarr, signed char **carr,
jbyteArray input) {
.
.
.
sz = (*jenv)->GetArrayLength(jenv, input);
*jarr = (*jenv)->GetByteArrayElements(jenv, input, 0);
.
.
.
for (i=0; i<sz; i++)
(*carr)[i] = (signed char)(*jarr)[i];
return 1;
}

you can see: it does Copy with a "for" loop.

This may suffer from Performance.

WHY does SWIG not Use the Get<PrimitiveType>ArrayRegion functions ??

Described here:
http://java.sun.com/products/jdk/1.2/docs/guide/jni/spec/functions.doc.html





Regards,

Franz Höpfinger (Diplomand)
**************************************

_______________________________________________
Swig maillist - Swig@xxxxxxxxxxxxxxx
http://mailman.cs.uchicago.edu/mailman/listinfo/swig



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise