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 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.
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.
LispWorks Foreign Language Interface User Guide and Reference Manual - 7 Dec 2011