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

NextPrevUpTopContentsIndex

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.

Example
(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


LispWorks Foreign Language Interface User Guide and Reference Manual - 7 Dec 2011

NextPrevUpTopContentsIndex