Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2005-08-22 01:18:48


Robert Ramey wrote:

> Vladimir Prus wrote:
>>> I havn't considered it in detail but its easy to consider using a
>>> semaphore
>>> (even though I'm sure there are better solutions). Semaphore is
>>> incremented
>>> each time an archive is opened. DLL Loading/Unloading code blocks
>>> until reaches zero.
>>
>> All DLL loading/unloading? Remember we can't check if DLL uses
>> serialization until we load it.
>
> We're loading the DLL because we know apriori that it contains the code
> that implements serialization for a particular class.

No, you either missed or ignored my one of my points. We might be loading
DLL because we want to invoke some service it provides and don't even
*care* if that DLL contains any BOOST_CLASS_EXPORT.

>> And further: say you have a server that talks with 10 clients at the
>> same time using some archive class. One client requests an operations
>> that needs loading a DLL. Do you expect that:
>
>> 1. Server will stop accepting new connections
>> 2. Wait till 9 other connections stop
>> 3. After that, load the DLL?
>
> The serialization system requires that code to save/load types exist in
> both
> contexts. This is a fundamental limitation of the system. Its up to the
> user to decide if this limitation makes it unsuitable for his application.
> In practice, I would expect that in a system such as the above, all known
> types would be loaded before any data is transmitted.

0. Again, DLL loaded by demand might contains BOOST_CLASS_EXPORT that's not
   even used in the current communication at all.
1. You did not answer my direct question what should happen in this case.
Generally speaking, you can expect that all DLLs are loaded before server
starts talking over network -- what's the point of on-demand DLLs then?

>> or simply that all connection will be dropped?
>
> What ever the library user want's to do.

Look, you impose some restriction on library user and says that he can do
anything he wants to overcome that restriction. That sounds strange to me
-- unless you provide some specific solution, how can be know that a
solution exists at all?

>> Now, on Unix all static initialisers are run when the program is first
>> loaded, so I probably should not care if some other users run into
>> problems.
>
> I don't believe this is a feature of the operating system but rather the
> compiler. I also believe that the serialization library presumes
> correctly
> that they will be invoked a pre-execution time. I never really thought of
> what happens when a DLL contains BOOST_CLASS_EXPORT, but it turns out only
> a little bit of extra work was required to remove some table entries when
> a DLL was unloaded.

As pointed by Rob, this statement is not 100% accurate.

- Volodya


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk