[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mono-gtk-sharp-list
Subject:    [Gtk-sharp-list] [Fwd: GLib.SList, etc]
From:       Rachel Hestilow <hestilow () ximian ! com>
Date:       2002-08-07 19:05:31
Message-ID: 1028747133.15586.26.camel () nomad
[Download RAW message or body]

[Attachment #2 (multipart/mixed)]



[Attachment #5 (--=-5jScIDavvARbLAhCU3/w)]



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



["signature.asc" (application/pgp-signature)]
["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic