3.1 Type Constructors
(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.
(ctype-sizeof type) → exact-nonnegative-integer?
type : ctype? (ctype-alignof type) → exact-nonnegative-integer? type : ctype?
> (ctype-sizeof _int)
> (ctype-sizeof (_fun _int -> _int))
> (ctype-alignof _int)
> (ctype-alignof (_fun _int -> _int))
→ (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.
> (ctype->layout _int)
> (ctype->layout _void)
> (ctype->layout (_fun _int -> _int))
sym : (or/c symbol? (listof symbol?))
> (compiler-sizeof 'int)
> (compiler-sizeof '(long long))