Hi,
I am a C/C++ programmer, but I was asked to update a program that was written in C# to communicate with a device. My knowledge of C# is very basic.
The previous version was totally written in C#, but now the API that in fact access the device was changed to C. I found out that I can import the C function APIs by using:
[DllImport("myapi.dll")]
public static extern int myfunct(
[MarshalAs(UnmanagedType.LPTStr)] string lpDeviceName,
IntPtr hpDevice);
In C this function prototype is:
int myFunct( LPTStr lpDeviceName, HANDLE* hpDevice );
Where HANDLE is defined as :
typedef void *HANDLE;
However this function does not work as expected. In fact, in the C# code call what kind of type I should declare and pass to the C# method?
Thanks for the help and sorry for any stupid question.