Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: wxLearner on March 15, 2007, 10:20:09 pm

Title: Code::Blocks and the gcc option -mthreads
Post by: wxLearner on March 15, 2007, 10:20:09 pm
Hello,
while looking in the build options of the windows Code::Blocks project from svn, I've realized, that the option -mthreads is used during compiling only, but it looks like the option is needed during linking too:
Quote from: gcc manual (http://gcc.gnu.org/onlinedocs/gcc-3.4.5/gcc/i386-and-x86_002d64-Options.html#i386-and-x86_002d64-Options)
-mthreads
    Support thread-safe exception handling on `Mingw32'. Code that relies on thread-safe exception handling must compile and link all code with the -mthreads option. When compiling, -mthreads defines -D_MT; when linking, it links in a special thread helper library -lmingwthrd which cleans up per thread exception handling data.
I've done a small test and the result is, a program doesn't need mingw10m.dll, if -mthreads isn't used in Linker settings/Other linker options. I'm not sure, but it looks like mingwm10.dll is only needed by wxWidgets and Code::Blocks isn't linked thread-safe on windows.
Please correct me, if I'm wrong.
Title: Re: Code::Blocks and the gcc option -mthreads
Post by: mandrav on March 15, 2007, 11:11:51 pm
If it's not in the project settings then you 're right: it should be added.