Next: User-Defined Types, Previous: Calling Foreign Functions, Up: Foreign Functions [Contents][Index]
In this section we give a quick overview of what else can be done with foreign objects or foreign function definitions.
Return non-nil
if fo is an FFI object, nil otherwise.
Return fo’s type.
Cast fo to type type and reassign the cast value.
Return the size of the allocated space of fo.
Set the size of the allocated space of fo to size.
Return the FFI object that stores address of given FFI object fo.
This is the equivalent of the ‘&’ operator in C.
Return the data fo-pointer points to.
This is the equivalent of the ‘*’ operator in C.
Return non-nil
if fo is a null pointer, nil
otherwise.
Non-nil
may be returned only for pointer types or the type
‘c-string’.
Return the FFI object that represents a null pointer.
This is the equivalent of ‘NULL’ in C.
For foreign arrays, unions and structures, there are accessor functions to modify or fetch portions in the foreign object:
Return the element of farray at index idx. The slot enumeration starts at 0.
Store the element value in farray at index idx. The slot enumeration starts at 0.
Return the offset of slot in type.
slot can be either a valid (named) slot in type or
nil
.
If slot is nil
return the size of the structure.
(define-ffi-type mystruct (struct foo (bar int) (hey char) (baz c-string))) (ffi-slot-offset 'mystruct 'baz) ⇒ 8
Next: User-Defined Types, Previous: Calling Foreign Functions, Up: Foreign Functions [Contents][Index]