Chromatic <[EMAIL PROTECTED]> wrote:
> Hi there,

> This one-line change to t/pmc/nci.t demonstrates an apparent bug
> somewhere in passing arrays of structs to NCI functions.

No.

> Alternately, I could be doing things wrong again.  :)

Yes.

The test is passing an array of structs to the C function. This implies
that you are responsible for setting up the storage for the array. This
is accomplished by creating a ManagedStruct PMC (P5).

Now WRT your change: The contained UnManagedStruct (P6) describes the
layout of one array element. The array element already has its storage,
because you have an array of structs, so you have to use the
UnManagedStruct PMC.

OTOH if you had an array with pointers to structs, these pointers would
need a storage for the struct data. *Then* you would need a
ManagedStruct PMC. But not for this example.

It's always a question: who owns the needed storage memory.
Array of structs != array of pinters to structs.

leo

Reply via email to