I tried different things but i\'m getting mad with Interop.
(here the word string is not referred to a variabile type but \"a collection of char\"): I have an unmana
The biggest problem with passing strings from C++ back to C# is the memory allocation. The GC should be able to know how to cleanup the memory allocated for this string. Since C# has extensive COm interop support, it does know about COM BSTRs and how to allocate and deallocate these. Thus the easiest way to do this would be to use BSTR
on the C++ side and string
on the C# side.
Note, using BSTRs does not imply that your function has to be expose through COM.