I am writing a C# code, and there is a code that needs calling an unmanaged C++ library.
The signature in the library's header is like this
bool GetValueFromFile(char* sPathToFile, char* &sResult);
What signature should I translate this in C#? I tried:
bool GetValueFromFile(string filePath, ref string result)
But it does not work. There is no exception and the return value is true. But the string result stays null. It is the same for out string result
or StringBuilder result
.
I use Marshal.GetDelegateForFunctionPointer to get the function pointer as delegate.