Boost logo

Boost Users :

From: Roland Schwarz (roland.schwarz_at_[hidden])
Date: 2004-11-25 06:59:28


Richard Howells wrote:

>There are traps in the MS world. Some CRT functions (think strtok - yuk)
>use static data. If you build with the statically linked version of the
>library, each executable (.exe AND .dll) has it's own copy of that static
>data and they don't know about each other.
>
>All executables built with the dynamically linked version share the same
>copy of that static data.
>
>If you use the dynamically linked version then you should (on Win NT and up
>systems - not Win 9x) share the same copy of the code with all other apps in
>the system that use the CRT.
>
>
>
I can understand this. But I cannot see why this will be a problem.
Case 1):
Singgle threaded: As long as one isn't calling functions that modify
this data in between
no harm is done, whether two instances of static data or not.
Case 2):
Multi threaded: Every thread has its own local copy of static data in
TLS storage.
No harm again.

But perhaps I am still simply not beeing able to see the trap?

BTW.: Having a separate copy of the data in the (boostified) DLL will
improve robustness, not
making it worse. Altough it was recommended using the _same_ CRT which
gives rise to the
shared static data issue.

Roland


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net