-mthreads
Kai Tietz
ktietz70 at googlemail.com
Sun Sep 11 08:47:15 UTC 2011
2011/9/10 Simson Garfinkel <simsong at acm.org>:
>
>
> Hi. I'm still trying to get pthreads working reliably on mingw32 and
> mingw64.
> My question today --- if I am writing multi-threaded code, do i need to
> supply the -mthreads compiler option?
> Thanks
Well, this depends on the runtime-version you are using. Newer
version supports TLS-callbacks and so -mthreads is an nop-operation
for them, but for older runtime-versions it is mandatory to use it for
multi-threaded applications, which are using C++.
You should make sure in general to use shared libgcc and libstdc++, if
you are building an C++ application. This avoids some troubles you
otherwise might get into.
The pthread library doesn't depend on the -mthreads feature.
So in doubt, specify the -mthreads option and the additional the
options -shared-libgcc -shared-libstdc++.
Regards,
Kai
More information about the mingw
mailing list