Is it valid to use unsafe struct * as an opaque type instead of IntPtr in .NET Platform Invoke?
- by David Jeske
.NET Platform Invoke advocates declaring pointer types as IntPtr. For example, the following
[DllImport("user32.dll")]
static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, Int32 wParam, Int32 lParam);
However, I find when interfacing with interesting native interfaces, that have many pointer types, flattening everything into IntPtr makes…