[REBOL] Re: External library interface
From: lmecir:mbox:vol:cz at: 3-Jul-2003 9:08
Hi Romano,
> 1) I don't have Pro or command.
neither do I,...
> 2) I do not know how much is safe (look at the GC section of command doc)
Garbage Collection is not a problem for the application I mentioned.
> 3) Hope it helps :-)
Yes, it works!
> First we create a 36 byte data block:
>
> x: [] loop 10 [insert tail x [. [long]]]
Actually, it looks like 40 bytes? Another approach using chars:
x: head insert/dup [] [. [char!]] 40
> data: make struct! x none
this (together with the trick below), is a nice way, how to obtain a specific length
binary! What surprises me is, that we don't need distinct names for the structure elements
:-o.
> Now we create a struct which contains a pointer to a 36 bytes area:
>
> z: make struct! compose/deep [data [struct! [(x)]]] none
>
> >> third z
> == #{6863E500}
Perfect!