[Gdal-dev] Re: gdal swig interface Band.i Updated

Charlie Savage cfis at savagexi.com
Sat Aug 5 13:43:54 EDT 2006


Check to see if templates.i is included.

See:

http://www.swig.org/Doc1.3/Arguments.html#Arguments_nn5

Charlie

Daniele Romagnoli wrote:
> Hi,
> I Have a problem.
> 
> To generate wrappers for "gdal.i" interface I use this swig command from 
> gdal\swig\include directory:
> 
> swig -java -c++ -package org.gdal.gdal -IJava gdal.i
> 
> where Java (-IJava) is the gdal\swig\include\java subdirectory 
> containing files required when building wrappers for Java target Language.
> 
> Such a command generates some java files which need to be moved to 
> gdal\swig\java\org\gdal\gdal folder.
> It also generates the gdal_wrap.cxx file which need to be moved to 
> gdal\swig\java\gdal (rename it to gdal_wrap.cpp).
> 
> At this point, I run NMAKE /F makefile.vc <http://makefile.vc> in order 
> to build the 4 DLL (gdalconstjni.dll, gdaljni.dll, ogrjni.dll , 
> osrjni.dll) as well as the gdal.Jar file.
> But this error occurs during the NMAKE
> 
> .....
>         cd gdal
>         nmake /nologo /f makefile.vc <http://makefile.vc>
>         cl /nologo /MD /EHsc /Zi /Fd..\..\..\gdal.pdb -I..\..\..\port 
> -I..\..\..
> \ogr -I..\..\..\gcore  -I..\..\..\alg  -I"c:/j2sdk1.4.2_08"/include 
> -I"c:/j2sdk1
> .4.2_08"/include/win32 /c gdal_wrap.cpp
> gdal_wrap.cpp
> gdal_wrap.cpp(1157) : error C2086: 'int *OUTPUT' : redefinition
>         gdal_wrap.cpp(1157) : see declaration of 'OUTPUT'
> gdal_wrap.cpp(1157) : fatal error C1903: unable to recover from previous 
> error(s
> ); stopping compilation
> NMAKE : fatal error U1077: 'cl' : return code '0x2'
> Stop.
> NMAKE : fatal error U1077: '"C:\Programmi\Microsoft Visual Studio .NET 
> 2003\VC7\
> BIN\nmake.exe"' : return code '0x2'
> Stop.
> 
> 
> In effect, the automatically generated wrapper gdal_wrap.cpp contains 
> this code:
> 
> SWIGINTERN void GDALRasterBandShadow_GetBlockSize(GDALRasterBandShadow 
> *self,int *OUTPUT,int *OUTPUT){
>       GDALGetBlockSize(self, blockXSize, blockYSize);
> }
> 
> 
> Maybe I'have missed some option using swig to generate wrappers...
> My first (old) version is working:
> 
>  %apply (int *OUTPUT){int *blockXSize, int *blockYSize}
>    void GetBlockSize(int *blockXSize, int *blockYSize){
>                GDALGetBlockSize(self, blockXSize, blockYSize);
>    }
> 
> 
> What I have to do to make working the semplified version?
> I need to Include some other directory in the swig command?... I need to 
> set some option using SWIG?
> 
> Thanks a lot.
> 
> -- 
> Best Regards,
> Daniele
> 
> 
> 
> 
> On 8/5/06, *Frank Warmerdam* <warmerdam at pobox.com 
> <mailto:warmerdam at pobox.com>> wrote:
> 
>     Charlie Savage wrote:
>      > The proposed wrapper code is correct.
>      >
>      > %apply (int *OUTPUT){int *blockXSize, int *blockYSize}
>      >   void GetBlockSize(int *blockXSize, int *blockYSize){
>      >               GDALGetBlockSize(self, blockXSize, blockYSize);
>      >   }
>      >
>      >
>      > And could be further simplified to:
>      >
>      >   void GetBlockSize(int *OUTPUT, int *OUTPUT){
>      >               GDALGetBlockSize(self, blockXSize, blockYSize);
>      >   }
>      >
>      > What's nice is that it will work with all SWIG languages.  For those
>      > interested, some more technical background below.
> 
>     Charlie / Daniele,
> 
>     I have applied the simplified form to gdal/swig/include/Band.i.
> 
>     Best regards,
>     --
>     ---------------------------------------+--------------------------------------
>     I set the clouds in motion - turn up   | Frank Warmerdam,
>     warmerdam at pobox.com <mailto:warmerdam at pobox.com>
>     light and sound - activate the windows | http://pobox.com/~warmerdam
>     <http://pobox.com/%7Ewarmerdam>
>     and watch the world go round - Rush    | President OSGF,
>     http://osgeo.org <http://osgeo.org>
> 
> 
> 
> 
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.osgeo.org/pipermail/gdal-dev/attachments/20060805/6c978f57/smime.bin


More information about the Gdal-dev mailing list