Browse Source

Applied SuppressUnmanagedCodeSecurity to P/Invokes with WinApi calling conventions.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/592/merge
Dimitar Dobrev 10 years ago
parent
commit
36c55fc656
  1. 6
      src/Generator/Generators/CSharp/CSharpTextTemplate.cs

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

@ -2845,7 +2845,9 @@ namespace CppSharp.Generators.CSharp @@ -2845,7 +2845,9 @@ namespace CppSharp.Generators.CSharp
: ((FunctionType) attributedType.Equivalent.Type).CallingConvention;
TypePrinter.PushContext(CSharpTypePrinterContextKind.Native);
var interopCallConv = callingConvention.ToInteropCallConv();
if (interopCallConv != System.Runtime.InteropServices.CallingConvention.Winapi)
if (interopCallConv == System.Runtime.InteropServices.CallingConvention.Winapi)
WriteLine("[SuppressUnmanagedCodeSecurity]");
else
WriteLine(
"[SuppressUnmanagedCodeSecurity, " +
"UnmanagedFunctionPointerAttribute(global::System.Runtime.InteropServices.CallingConvention.{0})]",
@ -2871,7 +2873,7 @@ namespace CppSharp.Generators.CSharp @@ -2871,7 +2873,7 @@ namespace CppSharp.Generators.CSharp
if (@enum.IsFlags)
WriteLine("[Flags]");
Write("{0} enum {1}", Helpers.GetAccess(@enum.Access), @enum.Name);
Write("{0}enum {1}", Helpers.GetAccess(@enum.Access), @enum.Name);
var typeName = TypePrinter.VisitPrimitiveType(@enum.BuiltinType.Type,
new TypeQualifiers());

Loading…
Cancel
Save