> 
> Message: 7
> Date: Tue, 10 Jul 2012 22:24:01 +0800
> From: JonY <[email protected]>
> Subject: Re: [Mingw-w64-public] problem with static linking -
>       libgcc_s_sjlj-1.dll - pthreadGC2.dll not statically linked
> To: [email protected]
> Message-ID: <[email protected]>
> Content-Type: text/plain; charset="iso-8859-1"
> 
> 
> Hi,
> 
> Please read pthreads-win32 technical notes, as I remembered, you need to
> initialize it manually if you're linking to static libraries, otherwise,
> your program crashes.
> 
> Obviously, this is a hassle if you're porting a lot of pthreads code,
> but I have seen some patches to attempt working around this.
> 
> I'm not sure if this applies to the pthreads you built, or if it is even
> relevant at all in newer pthreads-win32. Somebody please bring me up to
> date if I'm wrong.
> 


In fact, in version 2.0 of pthreads-win32 it is no longer necessary to call the 
initializer when one is statically linked. However my code already calls the 
initializer:

void threadpool::win32_init()
{
    pthread_win32_process_attach_np();
    pthread_win32_thread_attach_np();
}

Also, don't forget:

threadpool::~threadpool()
{
...

#ifdef WIN32
    pthread_win32_process_detach_np();
    pthread_win32_thread_detach_np();
#endif
}



------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to