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

NextPrevUpTopContentsIndex

replace-foreign-object

Function
Summary

Copies the contents of one foreign object into another.

Package

fli

Signature

replace-foreign-object to from &key nelems => pointer

Arguments

to

A foreign object or a pointer to a foreign object.

from

A foreign object or a pointer to a foreign object.

nelems

An integer.

Values

pointer

A pointer to the object specified by from.

Description

The function replace-foreign-object copies the contents of the foreign object specified by from into another foreign object specified by to. Block copying on an array of elements can also be performed by specifying the number of elements to copy using the nelems argument.

Example

In the following object two sets of ten integers are defined. The object from-obj contains the integers from 0 to 9. The object to-obj contains random values. The replace-foreign-object function is then used to copy the contents of from-obj into to-obj.

(setf from-obj
      (fli:allocate-foreign-object
                  :type :int
                  :nelems 10
                  :initial-contents
                  '(0 1 2 3 4 5 6 7 8 9)))
(setf to-obj
      (fli:allocate-foreign-object
                  :type :int
                  :nelems 10 ))
(fli:replace-foreign-object to-obj from-obj :nelems 10)
See also

Modifying a string in a C function
allocate-foreign-object
fill-foreign-object
copy-pointer
make-pointer
replace-foreign-array


LispWorks Foreign Language Interface User Guide and Reference Manual - 16 Feb 2015

NextPrevUpTopContentsIndex