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

NextPrevUpTopContentsIndex

size-of

Function
Summary

Returns the size in bytes of a foreign type.

Package

fli

Signature

size-of type-name => size

Arguments

type-name

A foreign type whose size is to be determined.

Values

size

The size of the foreign type type-name in bytes.

Description

The function size-of returns the size in bytes of the foreign language type named by type-name .

Example

This example returns the size of the C integer type (usually 4 bytes on supported platforms):

(fli:size-of :int)

This example returns the size of a C array of 10 integers:

(fli:size-of '(:c-array :int 10))

The function size-of can also be used to determine the size of a structure:

(fli:define-c-struct POS
  (x :int)
  (y :int)
  (z :int))
(fli:size-of 'POS)
See also

allocate-foreign-object
free-foreign-object


LispWorks Foreign Language Interface User Guide and Reference Manual - 21 Dec 2009

NextPrevUpTopContentsIndex