Next: , Previous: foreign-type-alignment, Up: Foreign Types


foreign-type-size

Syntax

— Function: foreign-type-size type ⇒ size

Arguments and Values

type
A foreign type.
size
An integer.

Description

The function foreign-type-size return the size of type in bytes. This includes any padding within and following the in-memory representation as needed to create an array of type objects.

Examples

    (defcstruct foo
      (a :double)
      (c :char))
    
    CFFI> (foreign-type-size :double)
    ⇒ 8
    CFFI> (foreign-type-size :char)
    ⇒ 1
    CFFI> (foreign-type-size '(:struct foo))
    ⇒ 16

See Also

foreign-type-alignment