[gdal-dev] CSharp bindings question

apacker apacker at biosonicsinc.com
Wed Jun 10 10:01:01 PDT 2015


Hello,

I am new to GDAL, and SWIG.  I spent yesterday getting GDAL 1.11.2 compiled
and ran into similar errors trying to build the C# bindings as are being
discussed on this thread.  I am on Windows (7 Pro SP1 x64) using Visual
Studio 2013's command prompt.  I am using the current version of swigwin,
3.0.5.

FWIW, I was able to fix the errors by making the following changes.  Since I
don't really understand what SWIG is doing very well, I'm not sure how safe
these are, although they seem fairly minor.  I apologize if this has already
been discussed somewhere else - I'm reporting them just in case they are
helpful.

1. Change line 95 of
gdal-1.11.2/swig/include/csharp/swig_csharp_extensions.i from

to


This fixes errors saying that the upcast function does not exist.  These
errors happen starting with SWIG 2.0.0.

2. Delete lines 12-17 of
gdal-1.11.2/swig/include/csharp/swig_csharp_extensions.i - this fixes the
duplicate static constructor error CS0111.  This error is related to the
following entry from the SWIG changelog http://www.swig.org/Release/CHANGES. 
The change was first released in SWIG 2.0.0.



3. Add the "-DSWIG2_CSHARP" flag to my SWIG variable in
gdal-1.11.2/nmake.local.  This fixes numerous errors about basic .NET types
like IntPtr not being defined.  This is related to the following entry from
the SWIG changelog, first released in version 3.0.0:



Thanks!  I appreciate all the work that you and others have done to make
GDAL so nice.

Asa




--
View this message in context: http://osgeo-org.1560.x6.nabble.com/gdal-dev-CSharp-bindings-question-tp5207528p5210216.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.


More information about the gdal-dev mailing list