3.1 Type Constructors
procedure
(make-ctype type racket-to-c c-to-racket) → ctype?
type : ctype? racket-to-c : (or/c #f (any/c . -> . any)) c-to-racket : (or/c #f (any/c . -> . any))
The given conversion functions convert to and from the Racket representation of the new type. Either conversion function can be #f, meaning that the conversion for the corresponding direction is the identity function. If both functions are #f, type is returned.
The racket-to-c function takes any value and, if it is a valid representation of the new type, converts it to a representation of type. The c-to-racket function takes a representation of type and produces a representation of the new type.
Examples: | ||||||||
|
procedure
(ctype-sizeof type) → exact-nonnegative-integer?
type : ctype? (ctype-alignof type) → exact-nonnegative-integer? type : ctype?
Examples: | ||||||||
|
procedure
(ctype->layout type)
→ (flat-rec-contract rep symbol? (listof rep)) type : ctype?
'int8 'uint8 'int16 'uint16 'int32 'uint32 'int64 'uint64 'float 'double 'bool 'void 'pointer 'fpointer 'bytes 'string/ucs-4 'string/utf-16
The result can also be a list, which describes a C struct whose element representations are provided in order within the list. Finally, the result can be a vector of size 2 containing an element representation followed by an exact-integer count.
Examples: | ||||||
|
Examples: | ||||
|