I have a global variable defined in a c-library [ex: int globalcount = 0] and in library initialization function [say library_init] globalcount is incremented by 1.
The issue here is : when library open with dlopen and appln call library_init function and closed the libs using dlclose then again dlopen call is reseting the globalcount to 0.
I want to know how to prevent reset of global variable [I want globalcount must be 1 not 0] when next dlopen is called because process is not exit so global variable also must not reset.
If library linked to proceess using -l at link time , I am not facing the abv issue. the issue only when libs open using dlopen/dlclose [multiple times]
OS is Linux Prog Lan : C Compiler : gcc
How to do, memory in the data segment must not freed when dlclose called ?
dlcloseon that library. I can't figure out much use for that.