Browse Source

Instead of failing to generate methods with not found symbols, use a fallback "SymbolNotFound" symbol which at least makes the generated wrappers compile.

pull/1/head
triton 12 years ago
parent
commit
392843cf9b
  1. 16
      src/Generator/Generators/CSharp/CSharpTextTemplate.cs

16
src/Generator/Generators/CSharp/CSharpTextTemplate.cs

@ -1500,16 +1500,18 @@ namespace CppSharp.Generators.CSharp @@ -1500,16 +1500,18 @@ namespace CppSharp.Generators.CSharp
{
if(function.Ignore) return;
GenerateDeclarationCommon(function);
WriteLine("[SuppressUnmanagedCodeSecurity]");
NativeLibrary library;
if (!FindMangledDeclLibrary(function, out library))
return;
FindMangledDeclLibrary(function, out library);
GenerateDeclarationCommon(function);
var libName = (library != null) ? library.FileName : "SymbolNotFound";
Write("[DllImport(\"{0}\", ", libName);
var callConv = Helpers.ToCSharpCallConv(function.CallingConvention);
WriteLine("CallingConvention = CallingConvention.{0},", callConv);
WriteLine("[SuppressUnmanagedCodeSecurity]");
Write("[DllImport(\"{0}\", ", library.FileName);
WriteLine("CallingConvention = CallingConvention.{0},",
Helpers.ToCSharpCallConv(function.CallingConvention));
WriteLineIndent("EntryPoint=\"{0}\")]", function.Mangled);
if (function.ReturnType.Type.Desugar().IsPrimitiveType(PrimitiveType.Bool))

Loading…
Cancel
Save