How to get IntPtr to a native directx11 struct?
See the question and my original answer on StackOverflowID3D11Buffer*
is a pointer. If you want to get back a pointer, you'll have to pass a pointer to a pointer, so define your C++ method like this:
HRESULT getValues(int * debug, ID3D11Buffer** bufOut)
{
...
*bufOut = triangleVertBuffer;
...
}
And C# like this:
[DllImport("CreateID3D11Buffer.dll", CallingConvention = CallingConvention.StdCall)]
private static extern int getValues([In, Out] int[] debug, out IntPtr bufIn);
And this part should work.