Example of registering a finalizer for unsafe_wrapped data from ccall

Wow, thanks, that was simpler than expected. So do you know if I need the closure function at all or can I use the do block for this directly, i.e.

return finalizer(dataRef) do
    @ccall mylib.closeRecord(handle::Cint)::Cvoid
end

or would the handle go out of context?