<div dir="ltr">Hi Asa,<div><br></div><div>Thanks for the detailed investigation, I'll evaluate the result of the changes and try to incorporate them in GDAL.</div><div><br></div><div>Best regards,</div><div><br></div><div>Tamas</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-06-10 20:07 GMT+02:00 Asa Packer <span dir="ltr"><<a href="mailto:apacker@biosonicsinc.com" target="_blank">apacker@biosonicsinc.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello again,<br>
<br>
Sorry, I posted this using the Nabble gateway, and the text I formatted as<br>
raw text did not come through correctly in email. Here is another try.<br>
<br>
-Asa<br>
---<br>
<span class="">Hello,<br>
<br>
I am new to GDAL, and SWIG. I spent yesterday getting GDAL 1.11.2 compiled<br>
and ran into similar errors trying to build the C# bindings as are being<br>
discussed on this thread. I am on Windows (7 Pro SP1 x64) using Visual<br>
Studio 2013's command prompt. I am using the current version of swigwin,<br>
3.0.5.<br>
<br>
FWIW, I was able to fix the errors by making the following changes. Since I<br>
don't really understand what SWIG is doing very well, I'm not sure how safe<br>
these are, although they seem fairly minor. I apologize if this has already<br>
been discussed somewhere else - I'm reporting them just in case they are<br>
helpful.<br>
<br>
1. Change line 95 of<br>
gdal-1.11.2/swig/include/csharp/swig_csharp_extensions.i from<br>
</span> public $csclassname(IntPtr cPtr, bool cMemoryOwn, object parent) :<br>
base($modulePINVOKE.$csclassnameUpcast(cPtr), cMemoryOwn, parent) {<br>
to<br>
public $csclassname(IntPtr cPtr, bool cMemoryOwn, object parent) :<br>
base($modulePINVOKE.$csclassname_SWIGUpcast(cPtr), cMemoryOwn, parent) {<br>
<span class=""><br>
This fixes errors saying that the upcast function does not exist. These<br>
errors happen starting with SWIG 2.0.0.<br>
<br>
2. Delete lines 12-17 of<br>
gdal-1.11.2/swig/include/csharp/swig_csharp_extensions.i - this fixes the<br>
duplicate static constructor error CS0111. This error is related to the<br>
following entry from the SWIG changelog <a href="http://www.swig.org/Release/CHANGES" target="_blank">http://www.swig.org/Release/CHANGES</a>.<br>
The change was first released in SWIG 2.0.0.<br>
<br>
</span>2010-05-23: wsfulton<br>
[C#] Fix #2957375 - SWIGStringHelper and SWIGExceptionHelper not<br>
always being<br>
initialized before use in .NET 4 as the classes were not marked<br>
beforefieldinit.<br>
A static constructor has been added to the intermediary class<br>
like this:<br>
<br>
%pragma(csharp) imclasscode=%{<br>
static $imclassname() {<br>
}<br>
%}<br>
<br>
If you had added your own custom static constructor to the<br>
intermediary class in<br>
the same way as above, you will have to modify your approach to<br>
use static variable<br>
initialization or define<br>
SWIG_CSHARP_NO_IMCLASS_STATIC_CONSTRUCTOR - See csharphead.swg.<br>
<br>
*** POTENTIAL INCOMPATIBILITY ***<br>
<span class=""><br>
3. Add the "-DSWIG2_CSHARP" flag to my SWIG variable in<br>
gdal-1.11.2/nmake.local. This fixes numerous errors about basic .NET types<br>
like IntPtr not being defined. This is related to the following entry from<br>
the SWIG changelog, first released in version 3.0.0:<br>
<br>
</span>2013-11-09: wsfulton<br>
[C#] Apply patch #79 from Brant Kyser<br>
- Remove using directives from the generated C# code and fully<br>
qualify the use of all .NET<br>
framework types in order to minimize potential name<br>
collisions from input files defining<br>
types, namespace, etc with the same name as .NET framework<br>
members.<br>
- Globally qualify the use of .NET framework types in the<br>
System namespace<br>
- Remove .NET 1.1 support, .NET 2 is the minimum for the C#<br>
module<br>
<br>
This is a potential backwards compatibility break if code has<br>
been added relying on these using<br>
statements that used to be generated:<br>
<br>
using System;<br>
using System.Runtime.InteropServices;<br>
<br>
The quick fix to add these back in is to add the -DSWIG2_CSHARP<br>
command line option when<br>
executing SWIG. See CSharp.html documentation for more info.<br>
<br>
*** POTENTIAL INCOMPATIBILITY ***<br>
<span class="im HOEnZb"><br>
Thanks! I appreciate all the work that you and others have done to make<br>
GDAL so nice.<br>
<br>
Asa<br>
<br>
<br>
</span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</div></div></blockquote></div><br></div>