J
Jason
I am trying to retrieve string data from a c++ dll:
extern "C" __declspec( dllexport ) const char * getbagstr();
extern "C" __declspec( dllexport ) const char * getbagstr() {
const char * buff = g.getbag()->getbagstr(true).c_str();
return buff;
}
VS 2005, C# declaration
[DllImport("Hotspots",EntryPoint="getbagstr",
CallingConvention=CallingConvention.StdCall)]
private static extern string getbagstr();
console output after calling function in C# is:
v►☺YYYYYYYYYYYYYZZZZZZZZZ
Where are the extra characters coming from at the beginning? I have tried
returning a BSTR but I had the same result. The data is correct, but only
after the junk at the beginning.
Any ideas on how to avoid this problem?
Thanks.
extern "C" __declspec( dllexport ) const char * getbagstr();
extern "C" __declspec( dllexport ) const char * getbagstr() {
const char * buff = g.getbag()->getbagstr(true).c_str();
return buff;
}
VS 2005, C# declaration
[DllImport("Hotspots",EntryPoint="getbagstr",
CallingConvention=CallingConvention.StdCall)]
private static extern string getbagstr();
console output after calling function in C# is:
v►☺YYYYYYYYYYYYYZZZZZZZZZ
Where are the extra characters coming from at the beginning? I have tried
returning a BSTR but I had the same result. The data is correct, but only
after the junk at the beginning.
Any ideas on how to avoid this problem?
Thanks.