
Roland wrote:
On Sun, 01 Aug 2004 16:41:18 -0500 "Aaron W. LaFramboise" <aaronrabiddog51@aaronwl.com> wrote:
Just as a FYI, I now have a copy of MSVC6, and am working on this.
MSVC6 does, in fact, have the necessary support, but there is a bug (I had noticed this before, and this was one of the reasons I wasn't able to offer more information a few months ago, and I had entirely forgotten about it. Oops.). Fortunately, the bug is in the runtime library, not in the linker or anything else.
Yes the bug is, that the TLS handlers must be in a contiguous area between the __xl_a and __xl_z symbols. I fixed this by running a small piece of code during the startup (in __xi_a .. __xi_z area).
Finally I wrapped everything up into a small C file that either can be bound to boost or be linked with the user application. Despite now having everything in a single file, I think boost still should not give away the possibility of letting the user code call the process/thread startup/termination hooks directly. There always might be some code that needs this.
I'm not planning to remove them.
Thanks to Aaron now now have a TLS solution that can handle any thread creation mechansim, while still reside in a statically bound library.
The tsstls.c file follows: To test it compile your application with BOOST_THREAD_USE_LIB
[code snipped] I must be missing something. I added the code you posted into Boost.Threads static library and built it--no problem. But then when I link with that library, I get: boost_cvs6sd.lib(threadmon.obj) : error LNK2001: unresolved external symbol "struct _IMAGE_TLS_DIRECTORY32 _tls_used" (?_tls_used@@3U_IMAGE_TLS_DIRECTORY32@@A) boost_cvs6sd.lib(threadmon.obj) : error LNK2001: unresolved external symbol "void (__stdcall** __xl_z)(struct HINSTANCE__ *,unsigned long,void *)" (?__xl_z@@3PAP6GXPAUHINSTANCE__@@KPAX@ZA) boost_cvs6sd.lib(threadmon.obj) : error LNK2001: unresolved external symbol "void (__stdcall** __xl_a)(struct HINSTANCE__ *,unsigned long,void *)" (?__xl_a@@3PAP6GXPAUHINSTANCE__@@KPAX@ZA) Debug6/boost_test.exe : fatal error LNK1120: 3 unresolved externals In the code you posted, the missing symbols are all defined as extern; what do I need to do to get their actually definitions linked in? Mike