|
Re: Java and Arrays: msg#00132programming.swig
Hoepfinger, Franz-Xaver (FH Rosenheim) wrote: HelloThe reason is for platform independence. SWIG wraps C code and so for the example you list above, you are wrapping a signed char type. On my system jbyte is typedef'd to signed char in a platform specific header file. Other systems will have jbyte typedef'd to other C types. So in a nutshell there is no way to know which JNI type is being used, which is necessary for the Get<PrimitiveType>ArrayRegion functions as they require a pointer to an array of the JNI type. Additionally, if the JNI to C mapping is known, unpredictable results would still be possible if the C array used a different packing to that used when the JVM was compiled. The approach taken skirts these problems as it accesses one element at a time with appropriate casting. I think the documentation mentions that this array library suffers performance problems and for better performance suggests using the main SWIG array library instead. The beauty of SWIG of course is that you can also customise the output by writing your own typemaps using a priori information about your platform. Cheers William _______________________________________________ Swig maillist - Swig@xxxxxxxxxxxxxxx http://mailman.cs.uchicago.edu/mailman/listinfo/swig |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: swig and perl580 and sun solaris compiler 5.3: 00132, Good Times |
|---|---|
| Next by Date: | Re: Autoconf support suggestion: 00132, William S Fulton |
| Previous by Thread: | Java and Arraysi: 00132, Hoepfinger, Franz-Xaver (FH Rosenheim) |
| Next by Thread: | linking problems: 00132, Good Times |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |