All Manuals > LispWorks Foreign Language Interface User Guide and Reference Manual > 7 Function, Macro and Variable Reference

NextPrevUpTopContentsIndex

with-foreign-block

Macro
Summary

Allocates a foreign block, executes code and frees the block, in LispWorks for Macintosh.

Package

fli

Signature

with-foreign-block (foreign-block-var type function &rest extra-args) &body body => results

Arguments

foreign-block-var

A symbol

type

A symbol naming a foreign block type defined using define-foreign-block-callable-type.

extra-args

Arguments.

Values

results

The results of body.

Description

The macro with-foreign-block allocates a foreign block using type, function and extra-args in the same way as allocate-foreign-block. It then binds foreign-block-var to the foreign block, execute the code of body and frees the foreign block using free-foreign-block, using unwind-protect.

with-foreign-block is a convenient way to ensure that you do not forget to free the foreign block.

Notes

If the foreign block is copied in the code of body, the copy may be invoked, and hence the function called, after exiting this macro. See the discussion in Scope of invocation.

with-foreign-block returns the results of body.

with-foreign-block is implemented in LispWorks for Macintosh only.

See also

allocate-foreign-block
free-foreign-block
with-local-foreign-block
Block objects in C (foreign blocks)


LispWorks Foreign Language Interface User Guide and Reference Manual - 29 Sep 2017

NextPrevUpTopContentsIndex