Boost logo

Boost Users :

From: Richard Howells (richard_at_[hidden])
Date: 2004-11-25 12:06:10


I think the classic example would be errno. If a call in your DLL set errno
and you attempted to check errno back in your EXE then:

- if you link BOTH with the DLL version you will both share the same errno
and will get the error code correctly

- if EITEHR is linked with the static library you will be using DIFFERENT
errno variables and will get the wrong error code.

Does that help?

- R

-----Original Message-----
From: boost-users-bounces_at_[hidden]
[mailto:boost-users-bounces_at_[hidden]] On Behalf Of Roland Schwarz
Sent: 25 November 2004 11:59
To: boost-users_at_[hidden]
Subject: Re: [Boost-users] Re: Memory leak reported using threads library

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 mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.797 / Virus Database: 541 - Release Date: 15/11/2004
 
---
Outgoing mail is Virus checked.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.797 / Virus Database: 541 - Release Date: 15/11/2004
 

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