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

foreign-block-copy Function


Makes a copy of a foreign block, in LispWorks for Macintosh.




foreign-block-copy foreign-block => new-foreign-block

A foreign block pointer.
A foreign block pointer.

The function foreign-block-copy makes and returns a copy of the foreign block foreign-block. It corresponds to the C function _Block_copy.

foreign-block can be any foreign block.

The result of the copy is another foreign block with an indefinite scope, which has the same attributes as foreign-block. In other words, invoking the copy invokes the same function.

The new foreign block cannot be garbage collected. It should be freed when you are finished with it by foreign-block-release.

foreign-block-copy is not expected to be commonly useful. You need it when you get passed a block and you want to use it outside the scope of the call in which it was passed, unless it is documented that the block is global.

  1. If you use new-foreign-block with a function that is documented to release the block, you must not call foreign-block-release on it. However, we do not expect this situation to happen, because a proper interface will only free blocks that it allocates.
  2. foreign-block-copy is implemented in LispWorks for Macintosh only.
See also

5.7 Block objects in C (foreign blocks)

Foreign Language Interface User Guide and Reference Manual - 01 Dec 2021 19:34:58