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

#### 8.3.2 Coercing Foreign Values

— Function: sb-alien:addr 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`.

— Function: sb-alien:cast 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.

— Function: sb-alien:sap-alien sap type

> The `sb-alien:sap-alien` function 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: sb-alien:alien-sap 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.