[Gtk-sharp-list] Upcoming problems.
Miguel de Icaza
26 May 2003 18:53:21 -0400
We recently found out that Dllimport signatures like this:
extern static string method ();
Carry an explicit invocation to 'free' on the result value returned
by the unmanaged code. This is done to avoid leaks.
Of course, this does not work with a bunch of places where we return
pointers to static memory (or what is flagged as "const" memory in some
To handle this case, the signature must be changed to use IntPtr to
make the return opaque, and then extract the string with
extern static IntPtr method ();
IntPtr r = method ();
string s = Marshal.PtrToStringAuto (r);
The bad news is that there are 162 cases like this on the binding,
and we are going to need Mike's help to fix this.
We have disabled the code that frees the strings in Mono in the