FFI: PLT Scheme Foreign Interface

1`` | Overview
2`` | Loading Foreign Libraries
3`` | C Types
4`` | Pointer Functions
5`` | Miscellaneous Support
6`` | Derived Utilities
7`` | Unexported Primitive Functions
8`` | Macros for Unsafety
| Index

On this page:

make-ctype
ctype?
ctype-sizeof
ctype-alignof
compiler-sizeof

Version: 4.0.2
contents index
← prev up next →

#### 3.1`` Type Constructors

(make-ctype type scheme-to-c c-to-scheme) → ctype?
type : ctype?
scheme-to-c : (or/c false/c (any/c . -> . any))
c-to-scheme : (or/c false/c (any/c . -> . any))

Creates a new C type value, with the given conversions functions. The conversion functions can be #f meaning that there is no conversion for the corresponding direction. If both functions are #f, type is returned.

(ctype? v) → boolean?
v : any/c

Returns #t if v is a C type, #f otherwise.

(ctype-sizeof type) → nonnegative-exact-integer?
type : ctype?
(ctype-alignof ctype) → nonnegative-exact-integer?
ctype : ctype?

Returns the size or alignment of a given type for the current platform.

(compiler-sizeof sym) → nonnegative-exact-integer?
sym : symbol?

Possible values for symbol are 'int, 'char, 'short, 'long, '*, 'void, 'float, 'double. The result is the size of the correspond type according to the C sizeof operator for the current platform. The compiler-sizeof operation should be used to gather information about the current platform, such as defining alias type like _int to a known type like _int32.

contents index
← prev up next →