On Fri, 8 Sep 2017, Jacek Caban wrote:
Hi Martin,
On 07.09.2017 14:47, Martin Storsjö wrote:
With clang, there's no mechanism with spec files. For compiling, it's
easy to add the -D__MSVCRT_VERSION__ yourself, but for linking,
-lmsvcrt is hardcoded. I send this patch for that yesterday:
https://reviews.llvm.org/D37530 (adding a separate option like
-mmsvcrt=ucrtbase)
But the suggestion currently seems to be to make the clang frontend
omit the -lmsvcrt if it detects something like -lmsvcr* among the libs.
Nice work! I think that it would be best to avoid users having to mess
with -D__MSVCRT_VERSION__ and linking options themselves. clang already
has -fms-compatibility-version option. Using that to set proper defines
and msvcrt linking options seems like an elegant and right solution. Did
you consider that?
I didn't consider that yet - I need to have a closer look and see if it
would work, or if that option is too much tied to the msvc mode in
general. That does indeed sound neat though.
A parallel issue that I haven't yet looked closer at, is the automatic
linking of -lkernel32 and similar. One might want to link to -lwindowsapp
instead (which means linking to the mess of api-ms-win-core-*.dll instead
of kernel32.dll), and in that case one might want to get rid of these
other automatically linked in system libs. One can always of course
customize the build environment and symlink libkernel32.a to
libwindowsapp.a, but that's just a hack.
// Martin
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public