Hi all,

The issue is on github link
<https://github.com/cloudius-systems/osv/issues/47>

Then we continue the discuss.

But I don't understand the "implicit" dependence you mention... It seems
> you mean that for some reason your application wants to know when or
> whether B is loaded


Actually, I'm talking about the reference count of A, and B depends on A.
When load B, it will recursive dlopen A.
So, there is a question, when load B how could *OSv *add A's reference
count too?

If we don't know the count, when unload A and load A again, because A is
still in memory, dlopen A will return a handle. the static variables in A
will not be reinitialized. If we use static variables's default constructors
dynamic create some thing in dlopen(we know that dlopen will do init first
and then transfer control to main), if A is in already in memory the init
will not work!

The following is the whole process:
1. load A
2. load B(B depends on A )
3. unload A
4. load A   ----->  *static variables* in A will not be reinitialized

If we have reference count of A is still 1(because we implement reference
count ourselves, I think when we unload A the reference count is 0, but
dlopen in system will be 1), then we know A is still in memory, and do some
work do deal with it.

Of course, we can also judge whether A is already in memory use dlopen with
*RTLD_NOLOAD* , if A is in memory we will deal with it.

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/CADNiy7oBE1Ldc9hcd0dZf35H885Q8icjNAeiXXbZaPK14C16Rg%40mail.gmail.com.

Reply via email to