[Gtk-sharp-list] Upcoming problems.

Rachel Hestilow rachel@nullenvoid.com
27 May 2003 18:54:13 -0500

Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

On Tue, 2003-05-27 at 18:39, Mike Kestner wrote:
> 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.=20
> Or maybe I'm oversimplifying?

Ah. I see now. I was initially confused about how PtrToString worked. I
figured that since it worked on const strings, it didn't involve a free,
but I wasn't sure if it was performing a copy operation as well. For
some reason I was under the impression it just referred back to the
original string without ever freeing it. Now having checked MSDN, I see
it does, which means we can just free the pointer like you say.

Ok, that's easy enough to do. I should be able to have that ready and
committed tonight.

-- Rachel

Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

Version: GnuPG v1.0.7 (GNU/Linux)