Get the latest tech news

Why did dlclose not unload the library? (2023)


Recently, at work, we were debugging an issue where dlclose was not unloading the library . You might wonder why that even matters - if your library contains any global symbols, then their state will persist across a dlopen, dlclose sequence.

It all started with some strange symptoms - a Rust construction routine was running multiple times in libA. Though only one copy of the symbols should be present due to the way dlopen works, the various failure cases around visibility (including modes like RTLD_LOCAL) were always a bit confusing to me. That explains why the static initialization routine was running multiple times - the library had been unloaded & so is starting from a clean slate.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of library

library

Related news:

News photo

I used these secret codes on Netflix to unlock its full library of shows and movies

News photo

Before you quit Netflix, use these secret codes to unlock its full library of shows

News photo

How well do coding agents use your library?