[Mono-devel-list] Re: [PATCH] Improper free of return-value string pointers from unmanagedcalls
swbrown at ucsd.edu
Fri Jun 11 02:35:51 EDT 2004
Chris Day wrote:
> Just as an FYI, Microsoft recommends  that any return or out
> parameters for strings (char*, wchar_t*, etc) use an IntPtr then use
> Marshal.PtrToString*  to copy it into managed land. If the function
> allocates the string it is then up to you to import a free() function
> which you can call with the IntPtr to deallocate the string.
In , he's talking about out parameters, not return parameters
(although he calls them return parameters). It's a different beast, as
the guy's code is written to expect an immutable string to be modified.
More information about the Mono-devel-list