Larry Wall <[EMAIL PROTECTED]> wrote:
> On Fri, Sep 03, 2004 at 11:41:05AM +0100, Tim Bunce wrote:

>: (I'm not (yet) familiar with Parrot's ManagedStruct and UnManagedStruct
>: types but there's probably valuable experience there.)

> Quite likely.

Well, *ManagedStruct is already working pretty well. It is used to
interface with C code that returns or takes structures of some natural
types. It supports nested structures and pointers to these as well as
arrays of items and a limited set of callback functions.

See e.g. runtime/parrot/library/SDL* for a lot of such usage.

Constructing such a struct takes a list of triples:
- data type
- optional array count of item
- optional offset

Alignment is calculated automatically, if offset is zero. Access to
structure items is by index or by name, if the initializer list
provides named items.

Under the hood an exact image of the C structure is created.

> Larry

leo

Reply via email to