I am developing a c# application that needs to calls functions from a c header file. I use
[System.Runtime.InteropServices.DllImport("xxx.dll", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true,SetLastError=true)]
public static extern Byte xxxx(IntPtr hResourceContext, ushort xxxx, ref structa aaa,ref Result_struct Result, Byte b);
to import the dll method. When I call this method in C#, the application simply exits without throwing an exception or error. I've used similar approach for other methods from the same dll which involves passing nested structs as parameter and they work
fine. I would like to know how I can debug the code/ catch errors/exceptions from the unmanaged code.
I tried to include the SetLastError=true during DllImport but it does not help.
View Complete Post