Browse Source

Add special marshaling attribute to delegate declaration if calling convention differs.

pull/234/head
Elias Holzer 11 years ago committed by triton
parent
commit
dcbf34b8e2
  1. 26
      src/Generator/Generators/CLI/CLIHeadersTemplate.cs

26
src/Generator/Generators/CLI/CLIHeadersTemplate.cs

@ -714,7 +714,31 @@ namespace CppSharp.Generators.CLI @@ -714,7 +714,31 @@ namespace CppSharp.Generators.CLI
PushBlock(CLIBlockKind.Typedef, typedef);
GenerateDeclarationCommon(typedef);
var insideClass = typedef.Namespace is Class;
var insideClass = typedef.Namespace is Class;
string callingConvention = null;
switch (function.CallingConvention)
{
case CallingConvention.C:
callingConvention = "Cdecl";
break;
case CallingConvention.StdCall:
callingConvention = "StdCall";
break;
case CallingConvention.ThisCall:
callingConvention = "ThisCall";
break;
case CallingConvention.FastCall:
callingConvention = "FastCall";
break;
}
if (callingConvention != null)
{
WriteLine("[{0}({1}::{2})] ",
"System::Runtime::InteropServices::UnmanagedFunctionPointer",
"System::Runtime::InteropServices::CallingConvention",
callingConvention);
}
WriteLine("{0}{1};",
!insideClass ? "public " : "",

Loading…
Cancel
Save