Boost logo

Boost :

From: Aaron W. LaFramboise (aaronrabiddog51_at_[hidden])
Date: 2004-08-05 12:43:11

Roland wrote:
> After having unified your and my code and having compared MSVC& and 7
> I came to the following observations so far:
> 1) MSVC6:
> The linker creates a named data segemnet when requested by the object
> that has a minimumsize of 260 Bytes. Then it assembles the pointer(s)
into this segement.
> In the result the sequence:

I positively cannot account for the behavior you are seeing. This does
not happen for me. Perhaps it was a bug on an earlier version of MSVC6.
 For reference, CL reports version 12.00.8168 and LINK reports version

In any case, if the following source file is added to the compile line
(to replace the broken tlssup.obj in the runtime library), TLS callbacks
work correctly on my copy of MSVC6 as they do on MSVC7.1:

#include <windows.h>

namespace {

#pragma const_seg(".tls")
extern const LONGLONG _tls_start = 0;
#pragma const_seg(".tls$ZZZ")
extern const LONGLONG _tls_end = 0;
#pragma const_seg()

} // namespace

extern "C" {

#pragma data_seg(".CRT$XLA")
#pragma data_seg(".CRT$XLZ")
#pragma data_seg()

DWORD _tls_index;

extern const IMAGE_TLS_DIRECTORY _tls_used = {
  &__xl_a + 1,

} // extern "C"

If this does not work for you, then there must be some other problem,
such as a linker bug as you mention, that does not occur on my MSVC6

At any rate, I think your suggested implementation is the way to go as
it gets everything right and works everywhere. :)

Aaron W. LaFramboise

Boost list run by bdawes at, gregod at, cpdaniel at, john at