Next Previous Up Top Contents Index

5 Function and Macro Reference

copy-pointer

Function

Summary

Returns a copy of a pointer object.
Package

fli

Signature

copy-pointer pointer &key type pointer-type => copy

Arguments

pointer

A pointer to copy.

type

The type of the object pointer to by pointer.

pointer-type

The type of pointer.

Values

copy

A copy of pointer.

Description

The functioncopy-pointer returns a copy of pointer.
Example

In the following example a pointerpoint1 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)

The results of this can be seen by evaluatingpoint1,point2, andpoint3.
The reason for this behavior is thatpoint1 andpoint2 are Lisp variables containing the same foreign object; a pointer to achar, whereaspoint3 contains a copy of the foreign pointer object.
See Also

make-pointer

LispWorks Foreign Language Interface - 12 Oct 1998

Next Previous Up Top Contents Index

Generated with Harlequin WebMaker