If pointer1 points to the same address as pointer2, pointer-eq
returns t
, otherwise it returns nil
.
The function pointer-eq
tests whether two pointers point to the same address, and returns t
if they do, and nil
if they do not.
In the following example a pointer, point1
, is defined, and point2
is set equal to it. Both are then tested to see if they are equal to each other using pointer-eq
. Then point2
is defined to point to a different object, and the two pointers are tested for equality again.
(setq point1 (fli:allocate-foreign-object :type :int))
(setq point2 point1)
(fli:pointer-eq point1 point2)
(setq point2 (fli:allocate-foreign-object :type :int))
(fli:pointer-eq point1 point2)
LispWorks Foreign Language Interface User Guide and Reference Manual - 16 Feb 2015