[erlang-bugs] Dynamic libraries are not closed on MacOS X [with patch]

Bjorn Gustavsson <>
Wed Sep 24 15:45:44 CEST 2008


2008/9/7 Paul Guyot <>

> Hello,
>
> On MacOS X, dynamic libraries opened with erl_ddll:load or load_driver are
> not closed when erl_ddll:unload/unload_driver is called.
>
> Steps to reproduce:
> * build a simple dynamic library, called simple_drv.so
> * start a new erlang shell in the same directory.
> * note down the PID.
> * evaluate erl_ddll:load(".", "simple_drv").
> * run lsof -p <PID> to see that indeed simple_drv.so file is open.
> * evaluate erl_ddll:unload("simple_drv").
> * run lsof -p <PID> to see that simple_drv.so file is still open.
>
> This is specific to MacOS X and this is simply because the code hasn't been
> written. On other Unix implementations, the erl_ddll code calls dlopen and
> dclose.
>
> The attached patch against R12B-4 fixes the bug and was tested on MacOS X
> 10.4/ppc.
>

Thanks for your patch.

It works fine, but we will use the simpler solution of using dlopen() on all
platforms:

http://www.erlang.org/pipermail/erlang-patches/2008-September/000293.html

/Bjorn

-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20080924/384e802c/attachment.html>


More information about the erlang-bugs mailing list