I have searched far and wide for an answer to my question, and all the solutions are not acceptable, not applicable, and/or confusing.
I am needing to return a string from a function implemented in C++
back to the calling code in C#
.
The returned string needs to be returned as a parameter rather than a return value since I need to pass/return multiple strings for some functions. The length of the string varies, so I can't just allocate a buffer, etc.
Any help would be appreciated.
NOTE: The solution posted and mentioned by Justin and/or others is NOT a solution for my use case. As I stated in the question, I do not know the size of the string prior to making the call to the C++ code. I can't pre-allocate a StringBuffer and pass it to the C++ code.