Next Previous Up Top Contents Index

5 Function and Macro Reference

foreign-array-pointer

Function

Summary

Returns a pointer to a specified element in an array.
Package

fli

Signature

foreign-array-pointer array &rest subscripts => pointer

Arguments

array

An FLI array or a pointer to an FLI array.

subscripts

A list of valid array indices for array.

Values

pointer

A pointer to the element at position subscripts in array.

Description

The functionforeign-array-pointer returns a pointer to a specified element in an array. The value pointed to can then be obtained by dereferencing the pointer returned, or set to a specific value by usingdereference andsetf.
Examples

In this example a 3 by 2 array of integers is created, and a pointer to the element at position2 0 is returned usingforeign-array-pointer.
(setq array1 (fli:allocate-foreign-object 
              :type '(:c-array :int 3 2)))

(setq array-ptr (fli:foreign-array-pointer array1 2 0))

Thedereference function can now be used withsetf to set the value pointed to byarray-ptr.
(setf (fli:dereference array-ptr) 42)

See Also

foreign-aref
foreign-array-dimensions
foreign-array-element-type

LispWorks Foreign Language Interface - 12 Oct 1998

Next Previous Up Top Contents Index

Generated with Harlequin WebMaker