MantisBT - CMake
View Issue Details
0013814CMakeCMakepublic2012-12-26 11:512014-06-02 08:37
Matt Williams 
jschueller 
normalmajoralways
closedfixed 
GCC 4.7openSUSE Linux12.2
CMake 2.8.10.2 
CMake 3.0 
0013814: SWIG C# generates a DllImport line that doesn't match the library name
When creating C# bindings with UseSWIG like:

  swig_add_module(MyModuleCSharp csharp MyModule.i)

then SWIG will generate code containing

  [DllImport("MyModule", EntryPoint="...")]

but the library name generated by CMake will be something like libMyModuleCSharp.so (note the 'CSharp' suffix). This causes the generated bindings to crash unless the library and module names just happen to match.

SWIG provides an argument to set the DllImport name to something else. By passing "-dllimport MyModuleCSharp" the DllImport line will contain the correct library name.

  [DllImport("MyModuleCSharp", EntryPoint="...")]

Attached is a patch which implements this inside SWIG_MODULE_INITIALIZE.
No tags attached.
patch swig_csharp_dllimport.patch (1,110) 2012-12-26 11:51
https://public.kitware.com/Bug/file/4606/swig_csharp_dllimport.patch
Issue History
2012-12-26 11:51Matt WilliamsNew Issue
2012-12-26 11:51Matt WilliamsFile Added: swig_csharp_dllimport.patch
2013-11-25 08:25Brad KingAssigned To => jschueller
2013-11-25 08:25Brad KingStatusnew => assigned
2013-11-25 09:17jschuellerNote Added: 0034549
2013-11-25 09:17jschuellerStatusassigned => resolved
2013-11-25 09:17jschuellerFixed in Version => CMake 3.0
2013-11-25 09:17jschuellerResolutionopen => fixed
2014-06-02 08:37Robert MaynardNote Added: 0036030
2014-06-02 08:37Robert MaynardStatusresolved => closed

Notes
(0034549)
jschueller   
2013-11-25 09:17   
http://cmake.org/gitweb?p=stage/cmake.git;a=commitdiff;h=acc59e55e12c1979735ba42569411892e215afba [^]
(0036030)
Robert Maynard   
2014-06-02 08:37   
Closing resolved issues that have not been updated in more than 4 months.