All Manuals > Foreign Language Interface User Guide and Reference Manual > 7 Function, Macro and Variable Reference

pointer-element-type Function

Summary

Returns the type of the foreign object pointed to by a FLI pointer.

Package

fli

Signature

pointer-element-type pointer-or-type => type

Arguments
pointer-or-type
A FLI pointer to a foreign object or the name of a FLI pointer type.
Values
type
The name of a FLI pointer type.
Description

The function pointer-element-type returns the type of the foreign object specified, or the element type of the foreign type specified.

If pointer-or-type is a FLI pointer, type is the type of the foreign object pointed to by pointer-or-type.

If pointer-or-type is the name of a FLI pointer type, type is the type of the elements of that FLI pointer type.

Examples

In the following example a pointer to an integer is defined, and pointer-element-type is used to confirm that the pointer points to an integer.

(setq point (fli:allocate-foreign-object :type :int))
(fli:pointer-element-type point)

In the next example a new type, happy, is defined. The pointer point is set to point to an instance of happy, and pointer-element-type is used to find the type of the object pointed to by point.

(fli:define-c-typedef happy :long)
(setq point (fli:allocate-foreign-object :type 'happy))
(fli:pointer-element-type point)
See also

3.2 Pointer testing functions
foreign-slot-type
pointer-element-size
pointer-element-type-p


Foreign Language Interface User Guide and Reference Manual - 01 Dec 2021 19:34:58