From 36f162eedf3772d2c0373651795e7e38b6d28fb4 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 17 Sep 2016 01:32:45 +0300 Subject: [PATCH] Explicitly add -lmingw32 before any other libraries This fixes linking when WinMain() is in a library (such as libmspcore) and shouldn't be harmful when it isn't. --- source/gnulinker.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/gnulinker.cpp b/source/gnulinker.cpp index 75a1bac..1b969b4 100644 --- a/source/gnulinker.cpp +++ b/source/gnulinker.cpp @@ -228,6 +228,9 @@ Task *GnuLinker::Linker::run(const Target &target) const bool static_link_ok = (binfo.libmode<=BuildInfo::STATIC); + if(architecture->get_system()=="windows" && architecture->get_cross_prefix().find("mingw")!=string::npos) + argv.push_back("-lmingw32"); + const Target::Dependencies &depends = target.get_dependencies(); for(Target::Dependencies::const_iterator i=depends.begin(); i!=depends.end(); ++i) { -- 2.43.0