Next Previous Up Top Contents Index

5 Function and Macro Reference

allocate-dynamic-foreign-object

Function

Summary

Allocates memory for an instance of a foreign object within the scope of awith-dynamic-foreign-objects macro.
Package

fli

Signature

allocate-dynamic-foreign-object &key type pointer-type
                                initial-element initial-contents
                                nelems => pointer

Arguments

type

An FLI type specifying the type of the object to be allocated. If type is supplied, pointer-type must not be supplied.

pointer-type

An FLI pointer type specifying the type of the pointer object to be allocated. If pointer-type is supplied, type must not be supplied.

initial-element

A keyword setting the initial value of every element in the newly allocated object to initial-element.

initial-contents

A list of forms which initialize the contents of each element in the newly allocated object.

nelems

An integer specifying how many copies of the object should be allocated. The default value is 1.

Values

pointer

A pointer to the specified type or pointer-type.

Description

The functionallocate-dynamic-foreign-object allocates memory for a new instance of an object of type type or an instance of a pointer object of type pointer-type within the scope of the body of the macrowith-dynamic-foreign-object. Once this macro has executed, the memory allocated usingallocate-dynamic-foreign-object is therefore automatically freed for other uses.
Example

A full example usingwith-dynamic-foreign-objects andallocate-dynamic-foreign-object is given in "An example of dynamic memory allocation" on page 6.
See Also

allocate-foreign-object
with-dynamic-foreign-objects

LispWorks Foreign Language Interface - 12 Oct 1998

Next Previous Up Top Contents Index

Generated with Harlequin WebMaker