What happens to the global variables in shared library when dlclose is called on it?
问题 If a shared library (or a DLL) is being used through dlopen and dlclose mechanism and if the shared library created has some global variables whose memory comes from the heap, then what will happen to those variables and the memory when dlclose is called? If in the same process, dlopen is called again, what will be the behaviour? 回答1: If dlclose reduces the reference count to zero and the library is actually unloaded, any future reloading of the library should reset all variables with static