public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: LIU Hao <lh_mouse@126.com>
To: mingw-w64-public@lists.sourceforge.net,
	"Pali Rohár" <pali.rohar@gmail.com>,
	gcc@gcc.gnu.org
Subject: Re: [Mingw-w64-public] gcc parameter -mcrtdll= for choosing Windows C RunTime DLL library
Date: Sun, 20 Nov 2022 21:36:19 +0800	[thread overview]
Message-ID: <3966ae87-8e0e-3fba-bb3e-4be572c17e04@126.com> (raw)
In-Reply-To: <20221120125348.a6xh7kxmvrimse72@pali>


[-- Attachment #1.1: Type: text/plain, Size: 1369 bytes --]

在 2022-11-20 20:53, Pali Rohár 写道:
> Hello! I would like to propose a new parameter for gcc: -mcrtdll= to
> allow specifying against which Windows C Runtime library should be
> binary linked. On Windows there are more crt libraries and currently gcc
> links to libmsvcrt.a which is in most cases symlink to libmsvcrt-os.a
> (but can be changed, e.g. during mingw-w64 building). mingw-w64 project
> already builds import .a library for every crt dll library (from the old
> crtdll.dll up to the new ucrtbase.dll), so it is ready for usage. Simple
> patch for gcc which implements -mcrtdll parameter is below. Note that on
> internet are other very similar patches for -mcrtdll= parameters and
> some are parts of custom mingw32 / mingw-w64 gcc builds. What do you
> think? Could gcc have "official" support for -mcrtdll= parameter?
> 
> 

It's not enough to just link against the desired library, you will also have to define 
`__MSVCRT_VERSION__` accordingly (for UCRT it should be defined as `0xE00` i.e. 14.0).

The current status of such mechanism is that both the macro `__MSVCRT_VERSION__` and the library 
'libmsvcrt.a' are determined when building mingw-w64, configurable by `--with-default-msvcrt=`, so 
they always match.


[1] https://sourceforge.net/p/mingw-w64/mailman/message/36030072/




-- 
Best regards,
LIU Hao


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

  reply	other threads:[~2022-11-20 13:36 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-20 12:53 Pali Rohár
2022-11-20 13:36 ` LIU Hao [this message]
2022-11-20 15:06   ` [Mingw-w64-public] " Pali Rohár
2022-11-21  5:21     ` LIU Hao
2022-11-26 19:09       ` Pali Rohár
2022-11-27  1:06         ` sotrdg sotrdg
2022-11-20 14:45 ` Eli Zaretskii
2022-11-20 15:04   ` Pali Rohár
2022-11-20 15:23     ` Eli Zaretskii
2022-11-20 15:44       ` Pali Rohár
2022-11-20 15:58         ` Eli Zaretskii
2022-11-20 16:19           ` [Mingw-w64-public] " ralph engels
2022-11-20 16:20           ` Matthew Brett
2022-11-20 21:22 ` Martin Storsjö
2022-12-04 12:16 ` Pali Rohár
2022-12-04 12:48   ` LIU Hao
2023-04-21 16:23     ` Pali Rohár
2023-05-06 10:45       ` Pali Rohár
2023-05-08  3:44         ` LIU Hao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3966ae87-8e0e-3fba-bb3e-4be572c17e04@126.com \
    --to=lh_mouse@126.com \
    --cc=gcc@gcc.gnu.org \
    --cc=mingw-w64-public@lists.sourceforge.net \
    --cc=pali.rohar@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).