How can I convert this Clarion procedure declaration to C#? It's part of a 3rd Party DLL written in C, which doesn't have much documentation. I have listed the prototype for the method in Clarion that is working correctly. In C#, I'm not sure what type to use to replace *CString
. I tried char[]
like @DanielC suggested, but it didn't work. I also found that Clarion long
is 32-bit (thanks @shf301).
Clarion:
SendRequest Procedure(*CString xData,Long DataLen,Long xTimeout),Byte,Virtual
C# (what I've tried, which doesn't work):
[DllImport("3RD_PARTY_API.dll")]
private static extern long SendRequest(ref string xData, int DataLen, int xTimeout);
When I call the SendRequest
method in C# I get the standard PInvokeStackImbalance was detected error from VS2010. I think it's an issue of the parameter types and not something like CharSet
or EntryPoint
in the DllImport declaration. I'm really just stuck on how to convert *CString
to a valid C# type.