Stats

60 Contributors: 2
2016-08-10
Licensed under: CC-BY-SA

Not affiliated with Stack Overflow
Rip Tutorial: info@zzzprojects.com

Download eBook

Platform Invoke

Download .net eBook

Syntax

  • [DllImport("Example.dll")] static extern void SetText(string inString);
  • [DllImport("Example.dll")] static extern void GetText(StringBuilder outString);
  • [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] string text;
  • [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] byte[] byteArr;
  • [StructLayout(LayoutKind.Sequential)] public struct PERSON {...}
  • [StructLayout(LayoutKind.Explicit)] public struct MarshaledUnion { [FieldOffset(0)]... }

Related Examples