[Gtk-sharp-list] Upcoming problems.

Paolo Molaro lupus@ximian.com
Wed, 28 May 2003 12:47:16 +0200


On 05/27/03 Mike Kestner wrote:
> > char* gtksharp_realloc_string (char *str) {
> > 	char *newstr = strdup (str);
> > 	g_free (str);
> > 	return newstr;
> > }
> 
> I think the simplest way to deal with it is to treat the return like an
> IntPtr in the DllImport, manually marshal it to a managed string with
> PtrToStringAnsi in the method body, and then dispose the IntPtr returned
> from the native method by pinvoking g_free. In other words, we take the
> memory management out of the JIT's hands. 

Yes, that sounds like the correct thing to do.

lupus

-- 
-----------------------------------------------------------------
lupus@debian.org                                     debian/rules
lupus@ximian.com                             Monkeys do it better