Next: , Previous: Accessing Foreign Values, Up: Operations On Foreign Values


8.3.2 Coercing Foreign Values

— Macro: addr [sb-alien] alien-expr

The sb-alien:addr macro returns a pointer to the location specified by alien-expr, which must be either a foreign variable, a use of sb-alien:deref, a use of sb-alien:slot, or a use of sb-alien:extern-alien.

— Macro: cast [sb-alien] foreign-value new-type

The sb-alien:cast macro converts foreign-value to a new foreign value with the specified new-type. Both types, old and new, must be foreign pointer, array or function types. Note that the resulting Lisp foreign variable object is not eq to the argument, but it does refer to the same foreign data bits.

— Macro: sap-alien [sb-alien] sap type

The sb-alien:sap-alien macro converts sap (a system area pointer) to a foreign value with the specified type. type is not evaluated.

The type must be some foreign pointer, array, or record type.

— Function: alien-sap [sb-alien] foreign-value

The sb-alien:alien-sap function returns the SAP which points to alien-value's data.

The foreign-value must be of some foreign pointer, array, or record type.