On Thu, 7 Sep 2017, JonY via Mingw-w64-public wrote:
On 09/07/2017 10:31 AM, Martin Storsjö wrote:
Hi,
This is a new reroll of the full patchset. Compared to the previous version,
I've fixed support for clang and improved the headers to behave closer to how
MSVC does (have the standard snprintf work as C99 standard snprintf should,
but keeping the old nonstandard _snprintf as it was), and made things more
prepared for users that want to keep using the nonstandard wchar_t printf
style.
Martin Storsjö (3):
crt: Add a def file for ucrtbase.dll
headers: Add ucrtbase.dll specific parts to headers
crt: Add compat wrappers for adapting the CRT startup and libmingwex
to ucrtbase.dll
mingw-w64-crt/Makefile.am | 34 +-
mingw-w64-crt/crt/ucrtbase_compat.c | 334 ++++
mingw-w64-crt/lib-common/ucrtbase.def.in | 2625 ++++++++++++++++++++++++++++++
mingw-w64-headers/crt/_mingw_stat64.h | 9 +
mingw-w64-headers/crt/stdio.h | 446 +++++
mingw-w64-headers/crt/stdlib.h | 3 +-
mingw-w64-headers/crt/wchar.h | 188 +++
7 files changed, 3633 insertions(+), 6 deletions(-)
create mode 100644 mingw-w64-crt/crt/ucrtbase_compat.c
create mode 100644 mingw-w64-crt/lib-common/ucrtbase.def.in
Looks good to me, but how do you use ucrtbase by default? gcc specs files?
Yes, that's what I used. Since there's a number of msvcr* files already, I
expected this to be pretty well known, but I found
https://stackoverflow.com/a/15865763/3115956 and did something similar to
that. (That post seems to do a lot of work to produce a versioned
moldname lib also, but afaik that's pointless since it's currently empty
and just kept for compatibility reasons?)
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.
// 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