вс, 25 авг. 2024 г. в 13:44, LIU Hao <[email protected]>:
> You can't use MSVCRT functions by simply linking with `-lmsvcrt`; it would 
> precede default
> libraries, specifically, the Cygwin DLL.

I explained this but some US government shits are rewriting my emails
so you did not see my explanation.

If you do:

gcc example.c -o example.exe -L/ucrt64/lib -lucrt

, that wil in fact put msvcrt before libcygwin in the link order and
not run. However, if you do:

gcc -c example.c
ld -o example.exe /usr/lib/crt0.o -lmsys-2.0 -lkernel32 -L/ucrt64/lib -lucrt

, that will put msvcrt after libcygwin in the link order and build and
run just fine.

This can be fixed in the linker scripts in the Cygwin/MSYS environments.

See my example with a Makefile with the link commands here:

https://github.com/rkitover/cygwin-binary-with-ucrt-example

.

> > , because "comutil.h" has this definition:
> >
> > #define _COM_PRINTF_S_1(dest,destsize,format,arg1)
> > sprintf_s(dest,destsize,format,arg1)
>
> This could be just the C99 `snprintf()` .

Thank you, I will prepare a patch to replace all the non-standard
functions I can find.


_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to