[squeak-dev] FFI | How to declare pointer to external structure in #fields?

Marcel Taeumel marcel.taeumel at hpi.de
Tue May 19 06:46:35 UTC 2020


Hi Levente.

>  Does MyStruct exist when you're writing this method?

Yes.

> If yes, is there a refence to that class in ExternalType's StructTypes class variable?

Yes.

**

The issue was that I wanted to make a pointer to the struct I am currently (re-)defining:

struct MyStruct {
   MyStruct *foobar;
};

Works fine when pointing to other structs. Should code generation work for this case? :-)

Best,
Marcel
Am 18.05.2020 21:28:49 schrieb Levente Uzonyi <leves at caesar.elte.hu>:
Hi Marcel,

On Mon, 18 May 2020, Marcel Taeumel wrote:

> Hi, there!
>
> In the #fields method of a new ExternalStructure, how can I express a pointer to another external structure?
>
> First, non-pointer works as expected:
> ^ #( (other MyStruct) )
>
> Second, this just treats it as a void*, which returns a generic ExternalData:
> ^ #( (other 'MyStruct*') )

This is how it should be written. Does MyStruct exist when you're writing
this method? If yes, is there a refence to that class in ExternalType's
StructTypes class variable?

Levente

>
> Third, this gives me a debugger:
> ^ #( (other MyStruct *) )
>
> :-)
>
> Best,
> Marcel
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200519/9b8ce308/attachment.html>


More information about the Squeak-dev mailing list