[Gtk-sharp-list] [Fwd: GLib.SList, etc]

Rachel Hestilow hestilow@ximian.com
07 Aug 2002 14:05:31 -0500


--=-2YvNBE22XLZS3W9ZVQ/U
Content-Type: multipart/mixed; boundary="=-jivHGHLQt/MrPEbuw9WV"


--=-jivHGHLQt/MrPEbuw9WV
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable




--=-jivHGHLQt/MrPEbuw9WV
Content-Disposition: inline
Content-Description: Forwarded message - GLib.SList, etc
Content-Type: message/rfc822

Subject: GLib.SList, etc
From: Rachel Hestilow <hestilow@ximian.com>
To: duncan@ximian.com
Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-5jScIDavvARbLAhCU3/w"
X-Mailer: Ximian Evolution 1.0.8 
Date: 07 Aug 2002 13:58:13 -0500
Message-Id: <1028746695.14936.24.camel@nomad>
Mime-Version: 1.0


--=-5jScIDavvARbLAhCU3/w
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

So for SList and List, there are two cases (that I am aware of, in the
Gtk+ APIs):
  1) Read-only, we do not own the memory
  2) Modifiable, we own the memory

We also need to use case 2 for passing lists into methods.

The question is, how can we identify programmatically which case is
which? _If_ the Gtk+ APIs are coded correctly, case 1 should be tagged
with const. Then we could have two entries in SymbolTable
(manually_wrapped_types), one for const (case 1) and one for normal
(case 2).

For case 1 we are only going to be getting IntPtrs from the list.
Unfortunately there is no way of figuring out what type this should be
marshalled to, so we should just leave it IntPtr for now.

For case 2 we need to handle marshalling common managed types into
IntPtr. The Marshal class is your friend here. For wrapping ints into an
IntPtr, there are special IntPtr constructors. For objects and opaque
structs, we can use the Handle property. We also need to free the list
structure in a destructor.

-- Rachel



--=-5jScIDavvARbLAhCU3/w
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part
Content-Transfer-Encoding: quoted-printable

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQA9UW3FapOJdUj74F4RAkrVAJ9kEf2dLIrUiABToCb9STjKrYH5ZgCgkad/
srs3B3eX8n7akK3O8ot1lFs=3D
=3DmU25
-----END PGP SIGNATURE-----

--=-5jScIDavvARbLAhCU3/w--


--=-jivHGHLQt/MrPEbuw9WV--

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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQA9UW97apOJdUj74F4RAue/AJ0bUfu4WC+r+V59RwLa0j5jc9vaJwCgj4PU
MIBICDi8RyEendRZi3oQDdI=
=pJF2
-----END PGP SIGNATURE-----

--=-2YvNBE22XLZS3W9ZVQ/U--