[cmake-developers] [CMake 0013814]: SWIG C# generates a DllImport line that doesn't match the library name

Mantis Bug Tracker mantis at public.kitware.com
Wed Dec 26 11:51:43 EST 2012


The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=13814 
====================================================================== 
Reported By:                Matt Williams
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   13814
Category:                   CMake
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2012-12-26 11:51 EST
Last Modified:              2012-12-26 11:51 EST
====================================================================== 
Summary:                    SWIG C# generates a DllImport line that doesn't
match the library name
Description: 
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.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2012-12-26 11:51 Matt Williams  New Issue                                    
2012-12-26 11:51 Matt Williams  File Added: swig_csharp_dllimport.patch         
          
======================================================================




More information about the cmake-developers mailing list