This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: about TLS and GCC


Jakub Jelinek <jakub@redhat.com> writes:
>I don't know how win32 handles dlopen (or whatever similar functionality it
>has) 

When a DLL loaded/unloaded  the entry point of the DLL is called
it has a signature like:

BOOL APIENTRY
DllEntryPoint(hInst, reason, reserved)
    HINSTANCE hInst;		/* Library instance handle. */
    DWORD reason;		/* Reason this function is being called. */
    LPVOID reserved;		/* Not used. */
{
    ...
}

Reason can be DLL_PROCESS_ATTACH, DLL_PROCESS_DETACH, 
DLL_THREAD_ATTACH or DLL_THREAD_DETACH

(Above is copied out of perl/Tk code - I can't remember if the reserved
thing is truly reserved or if I just don't use it.)

I don't think threads get to see new DLLs loaded by their parent after
they were created unless they open them themselves - i.e. I don't
think the "struct" pointed to by fs:0 is same in all threads
but is rather _the_ per-thread info for the kernel which has some 
well known offsets (and is presumably read-only to user-space).


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]