From c93e77166c9c98a5bd66dba5f00d21c530a5c3ad Mon Sep 17 00:00:00 2001 From: triton Date: Mon, 9 Sep 2013 05:27:48 +0100 Subject: [PATCH] Added a new option GenerateInternalImports that outputs "__Internal" as the library name for DllImports. Fixes #54. For more details about what it does: http://www.mono-project.com/Embedding_Mono#Exposing_C_code_to_the_CIL_universe). --- src/Generator/Driver.cs | 1 + src/Generator/Generators/CSharp/CSharpTextTemplate.cs | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/Generator/Driver.cs b/src/Generator/Driver.cs index a4f3907b..d7ae356c 100644 --- a/src/Generator/Driver.cs +++ b/src/Generator/Driver.cs @@ -261,6 +261,7 @@ namespace CppSharp public bool GenerateFunctionTemplates; public bool GeneratePartialClasses; public bool GenerateVirtualTables; + public bool GenerateInternalImports; public string IncludePrefix; public bool WriteOnlyWhenChanged; public Func GenerateName; diff --git a/src/Generator/Generators/CSharp/CSharpTextTemplate.cs b/src/Generator/Generators/CSharp/CSharpTextTemplate.cs index c84f8720..82b8b709 100644 --- a/src/Generator/Generators/CSharp/CSharpTextTemplate.cs +++ b/src/Generator/Generators/CSharp/CSharpTextTemplate.cs @@ -1998,6 +1998,9 @@ namespace CppSharp.Generators.CSharp libName = libName.Substring(3); } + if (Options.GenerateInternalImports) + libName = "__Internal"; + Write("[DllImport(\"{0}\", ", libName); var callConv = Helpers.ToCSharpCallConv(function.CallingConvention);