[gdal-dev] SWIG JNI binding question with GetMetadataItem function

Even Rouault even.rouault at mines-paris.org
Thu Aug 11 14:08:17 EDT 2011


> I've found a thread discussing a similar issue under the android-ndk
> group, but without the swig component:
> 
> 
> 
> http://groups.google.com/group/android-ndk/browse_thread/thread/27e83cdf
> 168bc0bb/db151ea4c15362c5?show_docid=db151ea4c15362c5
> 
> 
> 
> I infer from that discussion that either the GDAL interface definition
> file needs to be tweaked or I need to use javah instead of swig.

No, I don't think you need to tweak anything in the swig generated files. If 
there was an error, it would not work in the standard (non-Android) case too. 
And I verified it works just fine.

I'm not sure how you've compiled the gdal_warp.cpp, but if you didn't use the 
provided swig/java/GNUmakefile, there's one point you must be very careful that 
is mentionned at the bottom of that makefile :

# Do not remove -fno-strict-aliasing while SWIG generates weird code in upcast 
methods
# See http://trac.osgeo.org/gdal/changeset/16006

That would be a plausible cause for the crash, since in your particular case  
the GetMetadataItem() method is in the MajorObject class, so the Dataset 
object needs to call the SWIGDatasetUpcast() method...

> 
> 
> 
> I'm still new to all of this (including GDAL) so assume I'm missing
> something blatantly obvious.
> 
> 
> 
> Thanks for any help,
> 
> Jim P.


More information about the gdal-dev mailing list