> On 8 Nov 2016, at 12:49, Dimitris Chloupis <kilon.al...@gmail.com> wrote:
> 
> I was reaching a similar conclusion
> 
> Currently I have a void pointer to the struct with the members I mentioned 
> 
> I can get char[100] 
> 
> pointerToStruct fromCString
> 
> and I can get the int with
> 
> pointerToStruct getHandle integerAt: 101 size:4  signed: false
> 
> so if I want to pass the address of the pointer to my YourStruct instance 
> will I have to initialize with
> 
> YourStruct fromHandler: (pointerToStruct getHandle) 
> 
> is this a correct and safe way to pass the address ? 

yes.

Esteban

> 
> 
> On Tue, Nov 8, 2016 at 1:21 PM Esteban Lorenzano <esteba...@gmail.com 
> <mailto:esteba...@gmail.com>> wrote:
> it never could.
> you need to do a “special type”, who has to be something like:
> 
> YourStruct class>>initialize
>         Char100 := FFITypeArray ofType: #char.
> 
> fieldsDesc
>         ^ #(
>         Char100 data;
>         int count;
>         )
> 
> but then… you want to optimise that and in field accessors, who will look 
> something like this:
> 
> YourStruct >>data
>         "This method was automatically generated"
>         ^(FFITypeArray ofType: #char size: 100) fromHandle: (handle copyFrom: 
> 1 to: 100)
> 
> you can change that for:
> 
> YourStruct >>data
>         "This method was automatically generated"
>         ^Char100 fromHandle: (handle copyFrom: 1 to: 100)
> 
> and same for setter.
> (other way will work, but it will be suboptimal)
> 
> Esteban
> 
> > On 8 Nov 2016, at 12:10, Dimitris Chloupis <kilon.al...@gmail.com 
> > <mailto:kilon.al...@gmail.com>> wrote:
> >
> > I have FFIExternalStructure which has at class side
> >
> > fieldsDesc
> > ^#(
> > char data[100];
> > int count;
> > )
> >
> > if I try to do
> >
> > EphCPPTestStructure rebuildFieldAccessors .
> >
> > in order to generate the accessors for the members of the struct it 
> > complains with an error that it does not recognise the type of " [ "
> >
> > Does that mean that char arrays are other arrays are not supported as 
> > struct members or will I have to do this manually ?
> 
> 

Reply via email to