[Gdal-dev] Building SWIG Java with Visual C++ 8.0
Andrea Aime
aaime at openplans.org
Sun Mar 25 06:03:14 EDT 2007
Mateusz Loskot ha scritto:
> Hi,
>
> I tried to build SWIG Java bindings using Visual C++ 8.0 compiler
> and I got errors from javac about missing symbols.
>
> Here is detailed log of all my steps I took in the gdal\swig directory:
>
> http://mateusz.loskot.net/tmp/gdal-java-build.txt
>
> Am I doing anything wrong or the SWIG Java is incomplete in any way?
>
> I use following tools:
>
> SWIG 1.3.31
Hmmm... yeah, I already seen that issue when I tried to build gdal
java bindings under Windows, which unfortunately failed later because
java would not load the generated binding libraries.
Anyways, the following patch fixed the issue:
--- include/java/ogr_java.i (revisione 11066)
+++ include/java/ogr_java.i (copia locale)
@@ -46,6 +46,11 @@
/*
*
*/
+%pragma(java) jniclassimports=%{
+import org.gdal.osr.SpatialReference;
+import org.gdal.osr.CoordinateTransformation;
+%}
+
%pragma(java) moduleimports=%{
import org.gdal.osr.SpatialReference;
%}
What's funny is that under Linux the patch was not needed.
Under Linux I'm using swig 1.3.28 whilst on Windows the same
as you, 1.3.31.
I hope you manage making the libraries load too... just try
out one of the programs in the java bindings /apps directory...
no matter where I did put the libraries, it complained
that it could not load the libraries. This usually is caused
by failing to load a required library (transitively, that is,
it's not that it's not finding the gdal libs, but something
these depend onto).
Cheers
Andrea
More information about the Gdal-dev
mailing list