Browse Source

Added native to managed marshaling of function pointers.

pull/1/head
triton 12 years ago
parent
commit
595e42b880
  1. 11
      src/Generator/Generators/CLI/CLIMarshal.cs

11
src/Generator/Generators/CLI/CLIMarshal.cs

@ -134,7 +134,16 @@ namespace Cxxi.Generators.CLI
return typeMap.IsValueType; return typeMap.IsValueType;
} }
// TODO: How should function pointers behave here? FunctionType function;
if (decl.Type.IsPointerTo(out function))
{
Return.Write("safe_cast<{0}>(", typedef);
Return.Write("System::Runtime::InteropServices::Marshal::");
Return.Write("GetDelegateForFunctionPointer(");
Return.Write("IntPtr({0}), {1}::typeid))",Context.ReturnVarName,
typedef.ToString().TrimEnd('^'));
return true;
}
return decl.Type.Visit(this); return decl.Type.Visit(this);
} }

Loading…
Cancel
Save