J
John Bravo
Hello,
I have a function in C++ with the following definition
typedef HRESULT (WINAPI *PGetData)(OUT BYTE **pabc);
and am using P/Invoke method to call this method from C#.
I need the output parameter to be stored inside a string variable
containing byte value.
I have the following defined in my C# code:
public class ClassComm
{
[DllImport("mydll.dll", CharSet = CharSet.Auto, EntryPoint="#200")]
public static extern int GetDataX (
ref byte[] bytearr);
}
and calling it using:
byte[] bytearr = null;
ClassComm.GetDataX (ref bytearr);
However the length of bytearr returned is only 1 whereas when stepping
through the C++ code found the length to be 20.
What is the type of marshalling that needs to be used in this case?
Please help.
Thanks.
I have a function in C++ with the following definition
typedef HRESULT (WINAPI *PGetData)(OUT BYTE **pabc);
and am using P/Invoke method to call this method from C#.
I need the output parameter to be stored inside a string variable
containing byte value.
I have the following defined in my C# code:
public class ClassComm
{
[DllImport("mydll.dll", CharSet = CharSet.Auto, EntryPoint="#200")]
public static extern int GetDataX (
ref byte[] bytearr);
}
and calling it using:
byte[] bytearr = null;
ClassComm.GetDataX (ref bytearr);
However the length of bytearr returned is only 1 whereas when stepping
through the C++ code found the length to be 20.
What is the type of marshalling that needs to be used in this case?
Please help.
Thanks.