On Sat, Dec 20, 2025 at 02:16:34PM +0000, Sad Clouds wrote:
> As far as I understand the standard does not specify this behavior. I'm
> not saying there is no value in "fixing" it, but then this would not be
> strictly compliant with the standard, right?
> https://pubs.opengroup.org/onlinepubs/9799919799/functions/atexit.html

The problem is that neither Posix nor the C standard define a way to
unregister an atexit() registered function, which you would have to
do on dlclose() of the DSO that defines the function. And if there
would be something like unatexit(3), you would need a destructor
function to invoke it at dlclose() time.

The whole atexit(3) interface makes no sense in the context of manual
dlopen()/dlclose() during runtime. Destructor semantics are much better
and clearer for this case.

Martin

Reply via email to