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

Paul Guyot pguyot@REDACTED
Sun Sep 7 10:57:40 CEST 2008


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.

Regards,

Paul

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-erts_emulator_sys_unix_ddll.c
Type: application/octet-stream
Size: 807 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20080907/0e2b4fd3/attachment.obj>
-------------- next part --------------




More information about the erlang-bugs mailing list