```{index} single: dlclose (Peta::FFI) ``` ```{index} single: Peta::FFI::dlclose ``` # dlclose Release a library handle previously returned by `dlopen`. ## Synopsis ```perl Peta::FFI::dlclose($lib); ``` ## What you get back Always `1`. The return value exists so the call composes cleanly in expressions; inspecting it tells you nothing about success. ## Edge cases - **No argument** - croaks with `Peta::FFI::dlclose: requires library handle`. - **Zero or null handle** - silently ignored. Passing `0` is safe and commonly used as an "already closed" sentinel. - **Double close** - passing a handle that has already been released is undefined behaviour at the `dlclose` level; keep a single owner per handle or null out your copy after closing. - **Outstanding calls** - closing a library while a pointer or string it returned is still in use is undefined behaviour. Copy everything you need out of the library first.