Maybe a little question about the noob, but this is what has turned me on in the brine for the past few hours (or days) ...
I am calling a method from a DLL in my code in the .NET Framework 4.0
[DllImport("xeneth.dll")] public static extern ErrorCode XC_GetFrame(Int32 h, FrameType type, ulong ulFlags, IntPtr buff, uint size);
and then using it here:
if (XC_GetFrame(myCam, XC_GetFrameType(myCam), 0, IntPtr.Zero, (uint)fs) != ErrorCode.E_NO_FRAME)
However, when I run this in .NET 4.0, I get a P / INVOKE error, however ... doing this in 3.5 does not cause this error. After I and another programmer switched the code, we seemed to put it on IntPtr, working differently on 4.0.
My application should run in .NET 4.0, as a couple of the functions required by the application are only available in 4.0 ...
Is there anything that I may forget or just forget to turn on?
Any thoughts are greatly appreciated!
Tom
Update:
Basic declaration:
virtual ErrCode XCamera::GetFrame(FrameType type, unsigned long ulFlags, void *buffer, unsigned int size)
Error: PInvoke function call "DLLTest! DLLTest.Form1 :: XC_GetFrameType" has an unbalanced stack. This is likely due to the fact that the PInvoke managed signature does not match the unmanaged target signature. Verify that the calling agreement and PInvoke signature settings match the target unmanaged signature.