LispWorks COM/Automation User Guide and Reference Manual > 2 COM Reference Entries

NextPrevUpTopContentsIndex

co-task-mem-alloc

Function
Summary

Allocates a block of foreign memory for use in COM method argument passing.

Package

com

Signature

co-task-mem-alloc &key type pointer-type initial-element
initial-contents nelems => pointer

Arguments

type

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

pointer-type

A foreign 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 function co-task-mem-alloc calls the C function CoTaskMemAlloc() to allocate a block of memory. The various arguments are handled in the same way as for the function fli:allocate-foreign-object (see the LispWorks Foreign Language Interface User Guide and Reference Manual ).

Examples

Two ways to allocate memory for an integer:

(co-task-mem-alloc :type :int) (co-task-mem-alloc :pointer-type '(:pointer :int))
See also

co-task-mem-free


LispWorks COM/Automation User Guide and Reference Manual - 22 Dec 2009

NextPrevUpTopContentsIndex