Handbook
Glossary
<struct> ( class -- struct )
Factor handbook
»
C library interface
»
Struct classes
»
Creating instances of structs
Next:
<struct-boa> ( class -- quot: ( ... -- struct ) )
Vocabulary
classes
.
struct
Inputs
class
a
class
Outputs
struct
a
struct
Word description
Allocates garbage-collected heap memory for a new
struct
of the specified
class
. The new struct's slots are initialized with the initial values specified in the struct definition.
See also
<struct-boa>
,
malloc-struct
,
memory>struct
Definition
USING:
alien
alien.c-types
byte-arrays
classes.struct.private
kernel
;
IN:
classes.struct
:
<struct>
( class -- struct )
[
>c-ptr
clone
]
[
heap-size
<byte-array>
]
init-struct
;
inline