Hi,<br>I Have a problem.<br><br>To generate wrappers for "gdal.i" interface I use this swig command from gdal\swig\include directory:<br><br>swig -java -c++ -package org.gdal.gdal -IJava gdal.i<br><br>where Java (-IJava) is the gdal\swig\include\java subdirectory containing files required when building wrappers for Java target Language.
<br><br>Such a command generates some java files which need to be moved to gdal\swig\java\org\gdal\gdal folder.<br>It also generates the gdal_wrap.cxx file which need to be moved to gdal\swig\java\gdal (rename it to gdal_wrap.cpp).
<br><br>At this point, I run NMAKE /F <a href="http://makefile.vc" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">makefile.vc</a> in order to build the 4 DLL (gdalconstjni.dll, gdaljni.dll, ogrjni.dll
, osrjni.dll) as well as the gdal.Jar file.<br>But this error occurs during the NMAKE
<br><br>.....<br> cd gdal<br> nmake /nologo /f <a href="http://makefile.vc" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">makefile.vc</a><br> cl /nologo /MD /EHsc /Zi /Fd..\..\..\gdal.pdb -I..\..\..\port -I..\..\..
<br>\ogr -I..\..\..\gcore -I..\..\..\alg -I"c:/j2sdk1.4.2_08"/include -I"c:/j2sdk1
<br>.4.2_08"/include/win32 /c gdal_wrap.cpp<br>gdal_wrap.cpp<br><span style="font-weight: bold;">gdal_wrap.cpp(1157) : error C2086: 'int *OUTPUT' : redefinition</span><br style="font-weight: bold;"><span style="font-weight: bold;">
gdal_wrap.cpp(1157) : see declaration of 'OUTPUT'</span><br>gdal_wrap.cpp(1157) : fatal error C1903: unable to recover from previous error(s<br>); stopping compilation<br>NMAKE : fatal error U1077: 'cl' : return code '0x2'
<br>Stop.<br>NMAKE : fatal error U1077: '"C:\Programmi\Microsoft Visual Studio .NET 2003\VC7\<br>BIN\nmake.exe"' : return code '0x2'<br>Stop.<br><br><br>In effect, the automatically generated wrapper gdal_wrap.cpp contains this code:
<br><br>SWIGINTERN void GDALRasterBandShadow_GetBlockSize(GDALRasterBandShadow *self,<span style="font-weight: bold;">int *OUTPUT,int *OUTPUT</span>){<br> GDALGetBlockSize(self, blockXSize, blockYSize);<br>}<br><br>
<br>Maybe I'have missed some option using swig to generate wrappers...<br>My first (old) version is working:<br><br><span class="q"> %apply (int *OUTPUT){int *blockXSize, int *blockYSize}<br> void GetBlockSize(int *blockXSize, int *blockYSize){
<br> GDALGetBlockSize(self, blockXSize, blockYSize);<br> }<br><br><br>What I have to do to make working the semplified version?<br>I need to Include some other directory in the swig command?... I need to set some option using SWIG?
<br><br>Thanks a lot.<br><br></span>-- <br>Best Regards,<br>Daniele<br><br>
<br><br><br><div><span class="gmail_quote">On 8/5/06, <b class="gmail_sendername">Frank Warmerdam</b> <<a href="mailto:warmerdam@pobox.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">warmerdam@pobox.com
</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Charlie Savage wrote:<br>> The proposed wrapper code is correct.<br>><br>> %apply (int *OUTPUT){int *blockXSize, int *blockYSize}<br>> void GetBlockSize(int *blockXSize, int *blockYSize){<br>> GDALGetBlockSize(self, blockXSize, blockYSize);
<br>> }<br>><br>><br>> And could be further simplified to:<br>><br>> void GetBlockSize(int *OUTPUT, int *OUTPUT){<br>> GDALGetBlockSize(self, blockXSize, blockYSize);<br>> }<br>
><br>> What's nice is that it will work with all SWIG languages. For those<br>> interested, some more technical background below.<br><br>Charlie / Daniele,<br><br>I have applied the simplified form to gdal/swig/include/Band.i.
<br><br>Best regards,<br>--<br>---------------------------------------+--------------------------------------<br>I set the clouds in motion - turn up | Frank Warmerdam, <a href="mailto:warmerdam@pobox.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
warmerdam@pobox.com
</a><br>light and sound - activate the windows | <a href="http://pobox.com/%7Ewarmerdam" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://pobox.com/~warmerdam</a><br>and watch the world go round - Rush | President OSGF,
<a href="http://osgeo.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://osgeo.org
</a><br><br></blockquote></div><br><br clear="all"><br><br>