Sujet : Re: tcc - first impression. Was: Baby X is bor nagain
De : bc (at) *nospam* freeuk.com (bart)
Groupes : comp.lang.cDate : 02. Jul 2024, 15:18:10
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v61271$1lrja$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
User-Agent : Mozilla Thunderbird
On 02/07/2024 14:27, Michael S wrote:
On Tue, 2 Jul 2024 12:22:53 +0100
bart <bc@freeuk.com> wrote:
>
Both make use of msvcrt.dll. I don't consider it a dependency since
it has always been part of Windows. (I first starting using it in
1990s, from my other language, before I knew much about C, as it had
a simpler file API than Windows.)
>
Lots of other applications use it too. Including older gcc binaries
and applications compiled with those.
>
On Windows 11, probably 10 too, msvcrt.dll's printf routines support
%zu, and so does Tcc.
>
Not really.
DLL that supports newer feature has different name - VCRUNTIME140.dll
And choice of DLL version is not directly related to the version of
Windows.
Well, both tcc and mcc (my product) import msvcrt, not that runtime file, and printf/zu works.
You can test it directly using the program below if you like.
If you think that the OS craftily substitutues vcruntime140.dll in place of msvcrt.dll, then copy "c:\windows\system32\msvcrt.dll" to "fred.dll", to a folder where it can be found. Then change "msvcrt" beflow to "fred".
If %zu it doesn't work, then maybe your copy is old.
---------------------------
#include <windows.h>
#include <stdlib.h>
int main(void) {
int (*PRINTF)(const char*, ...);
HINSTANCE libinst;
libinst=LoadLibrary("msvcrt");
if (libinst==NULL) exit(1);
PRINTF=GetProcAddress(libinst, "printf");
if (PRINTF==NULL) exit(1);
PRINTF("sizeof void* = %zu\n", sizeof(void*));
}
---------------------------