FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Update C# bindings to work with SWIG 3.x by geographika · Pull Request #5583 · MapServer/MapServer · GitHub

Update C# bindings to work with SWIG 3.x - #5583

Merged
geographika merged 8 commits into
MapServer:masterfrom
geographika:c-sharp-swig
Oct 11, 2018
Merged

Update C# bindings to work with SWIG 3.x#5583
geographika merged 8 commits into
MapServer:masterfrom
geographika:c-sharp-swig

Conversation

geographika commented Apr 14, 2018
edited
Loading

Copy link
Copy Markdown
Member

See #5575

This initial pull request brings the number of errors when building with SWIG 3.0.12 from 1592 Error(s) to8 Error(s).

The remaining errors are:

[00:02:38]   mapscript.cs(25,58): error CS0234: The type or namespace name 'EntryPoint' does not exist in the namespace 'System.Runtime.InteropServices' (are you missing an assembly reference?) [C:\projects\mapserver\build\mapscript\csharp\mapscript.vcxproj]
[00:02:38]   mapscript.cs(25,4): error CS1729: 'DllImportAttribute' does not contain a constructor that takes 2 arguments [C:\projects\mapserver\build\mapscript\csharp\mapscript.vcxproj]
[00:02:38]   mapscriptPINVOKE.cs(191,10): error CS0111: Type 'mapscriptPINVOKE' already defines a member called '.cctor' with the same parameter types [C:\projects\mapserver\build\mapscript\csharp\mapscript.vcxproj]
[00:02:38]   mapscriptPINVOKE.cs(313,3): error CS0246: The type or namespace name 'ThreadStaticAttribute' could not be found (are you missing a using directive or an assembly reference?) [C:\projects\mapserver\build\mapscript\csharp\mapscript.vcxproj]
[00:02:38]   mapscriptPINVOKE.cs(313,3): error CS0246: The type or namespace name 'ThreadStatic' could not be found (are you missing a using directive or an assembly reference?) [C:\projects\mapserver\build\mapscript\csharp\mapscript.vcxproj]
[00:02:38]   mapscriptPINVOKE.cs(298,58): error CS0234: The type or namespace name 'EntryPoint' does not exist in the namespace 'System.Runtime.InteropServices' (are you missing an assembly reference?) [C:\projects\mapserver\build\mapscript\csharp\mapscript.vcxproj]
[00:02:38]   mapscriptPINVOKE.cs(298,4): error CS1729: 'DllImportAttribute' does not contain a constructor that takes 2 arguments [C:\projects\mapserver\build\mapscript\csharp\mapscript.vcxproj]

sdlime commented Jun 6, 2018

Copy link
Copy Markdown
Member

@geographika - have you had chance to investigate the AppVeyor issues? I assume that's more relevant to this particular issue. --Steve

geographika commented Jun 12, 2018
edited
Loading

Copy link
Copy Markdown
Member Author

@sdlime - the issues relate to using the newer version of SWIG rather than Appveyor, so the C# interface files need changes. I've not yet been able to fix the remaining 8 issues but will have another look.

Travis is passing as the C# bindings aren't built on Linux.

Copy link
Copy Markdown
Member Author

Related pull request in GDAL: OSGeo/gdal#824

geographika changed the title [WIP] Update C# bindings to work with SWIG 3.x Update C# bindings to work with SWIG 3.x Sep 30, 2018

Copy link
Copy Markdown
Member Author

This pull request is now complete. It does the following:

  • Replaces SWIG 1.3.39 used in the GISInternals Buildkit in Appveyor with the latest version of SWIG 3.0.12
  • This is then used to build the .NET MapScript and Python MapScript

SWIG 1.3.39 was released in 2009 and has issues with generating Python3 MapScript (and possibly PHP).

Nearly all changes to the CSharp MapScript interface files are to fully qualify .NET types. This is due to the following:

SWIG 3 fully qualifies the use of all .NET types. Furthermore, SWIG 3 avoids using directives in generated code. This breaks backwards compatibility with typemaps, pragmas,
etc written for use with SWIG 2 that assume the presence of using System; or using System.Runtime.InteropServices

http://www.swig.org/Doc3.0/CSharp.html#CSharp_introduction_swig2_compatibility

Only after completing the majority of these changes did I discover there is a flag to ignore these and maintain backwards compatibility:

If SWIG2_CSHARP is defined, SWIG 3 generates using directives in the intermediate class, module class, and proxy class code similar to those generated by SWIG 2.

By this stage it was as easy to complete the changes, which may make the code more future proof. .NET MapScript still compiles with SWIG 1.3.39 even with the changes in this pull request.

One further issue was the following needed to be commented out:

%pragma(csharp) imclasscode=%{
  static $imclassname() {	  //static $imclassname() {
  }	  //}

Otherwise the following build error occurred:

 mapscriptPINVOKE.cs(191,10): error CS0111: Type 'mapscriptPINVOKE' already defines a member called '.cctor' with the same parameter types [C:\Installation\release-1911-x64-dev\build\mapscript\csharp\mapscript.vcxproj]

geographika merged commit d725153 into MapServer:master Oct 11, 2018
geographika deleted the c-sharp-swig branch October 11, 2018 20:45
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL