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

fill-foreign-object Function

Summary

Fills a foreign object, given a pointer to it.

Package

fli

Signature

fill-foreign-object pointer &key nelems byte => pointer

Arguments
pointer
A foreign pointer.
nelems
A non-negative integer. The default is 1.
byte
An integer. The default is 0.
Values
pointer
The foreign pointer.
Description

The function fill-foreign-object fills the pointer pointer with the value byte. If nelems is greater than 1, an array of objects starting at pointer is filled.

Examples
(fli:with-dynamic-foreign-objects ()
  (let ((pp (fli:allocate-dynamic-foreign-object 
             :type :char 
             :initial-element 66
             :nelems 6)))
    (fli:fill-foreign-object pp :nelems 3 :byte 65)
    (loop for i below 6 collect 
          (fli:dereference pp :type :char :index i))))
=> 
(#\A #\A #\A #\B #\B #\B)
See also

replace-foreign-object


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