In one of the post Titled "Call a c++ method that returns a string, from c#"
Its said that , to make the following Pinvoke to work change the C++ signature to as
extern "C" REGISTRATION_API void calculate(LPSTR msg)
C++ code
extern "C" REGISTRATION_API void calculate(char* msg)
C# code
[DllImport("thecpp.dll", CharSet=CharSet.Ansi)]
static extern void calculate(StringBuilder sMsg);
How can stringBuilder which is a class ,convertd to long ptr to string .(but this is the accepted answer)
Shouldnt we use use IntPtr as below ?
extern "C" REGISTRATION_API void calculate(Intptr msg)