Hello,
i got a problem - i have a function inside a DLL with this signature
char *function(char *buffer);
In buffer there would be stored some text after calling the function. With StringBuilder i have to problem that it returns the string as wchar_t on pocketpc (and in fact two chars (char) form one wchar_t char then which produces garbage output.
Currently i am using it like this:
[DllImport("CFReader.dll")]
public static extern IntPtr DetectSerialPort([MarshalAs(UnmanagedType.LPStr)]StringBuilder buf);
StringBuilder temp_buffer = new StringBuilder(11);
DetectSerialPort(temp_buffer);
return temp_buffer.ToString();
i got a problem - i have a function inside a DLL with this signature
char *function(char *buffer);
In buffer there would be stored some text after calling the function. With StringBuilder i have to problem that it returns the string as wchar_t on pocketpc (and in fact two chars (char) form one wchar_t char then which produces garbage output.
Currently i am using it like this:
[DllImport("CFReader.dll")]
public static extern IntPtr DetectSerialPort([MarshalAs(UnmanagedType.LPStr)]StringBuilder buf);
StringBuilder temp_buffer = new StringBuilder(11);
DetectSerialPort(temp_buffer);
return temp_buffer.ToString();