This is the mail archive of the
pthreads-win32@sourceware.org
mailing list for the pthreas-win32 project.
Re: Static libraries initialization
- From: Roland Schwarz <roland dot schwarz at chello dot at>
- To: Pthreads-Win32 list <pthreads-win32 at sourceware dot org>
- Cc: Ross Johnson <Ross dot Johnson at homemail dot com dot au>, Ramiro Polla <ramiro at lisha dot ufsc dot br>
- Date: Mon, 19 May 2008 13:29:11 +0200
- Subject: Re: Static libraries initialization
- References: <481082AE.3030904@lisha.ufsc.br> <4810ABB9.10106@homemail.com.au> <4810D5C3.2070306@lisha.ufsc.br> <4811657E.40608@homemail.com.au>
Ross Johnson wrote:
> Now there is only the thread detach cleanup to deal with. I haven't
> found an equivalent to atexit() for win32 native threads. Is there one,
> or is there another way to make this automatic? The problem is as follows:-
Sorry for dropping in. I did not follow this list for a while, but the
above question triggered me.
While I was solving the cleanup problem for the boost TLS implementation
for static linking I came over a not so well known feature of the PE
file format:
The operating system calls into a hook on every detaching thread similar
to DllMain, but also for statically linked libs.
Withou going into detail: This is compiler dependent and has been made
working for MSVC and gcc compilers. Borland unfortunately cannot
be made to work. :-(
You might look for the details in the boost threading lib, or contact
me if you need more details.
Ah, yes not to forget to mention: credits for this idea go to Aaron La
Framboise.
Regards,
--
_________________________________________
_ _ | Roland Schwarz
|_)(_ | aka. speedsnail
| \__) | mailto:roland.schwarz@chello.at
________| http://www.blackspace.at