Function
fli
copy-pointer pointer &key type pointer-type => copy
A pointer to copy.
The type of the object pointer to by pointer.
The type of pointer.
A copy of pointer.
copy-pointer
returns a copy of pointer. point1
is created, pointing to a:char
type. The variablepoint2
is set equal topoint1
usingsetq
, whereaspoint3
is set usingcopy-pointer
. Whenpoint1
is changed usingincf-pointer
,point2
changes as well, butpoint3
remains the same. (setq point1 (fli:allocate-foreign-object :type :char)) (setq point2 point1) (setq point3 (fli:copy-pointer point1)) (fli:incf-pointer point1)
point1
,point2
, andpoint3
. point1
andpoint2
are Lisp variables containing the same foreign object; a pointer to achar
, whereaspoint3
contains a copy of the foreign pointer object. make-pointer