If I use those coming with the mingw64 proposed by a linux package manager, manually linking a betterC object containing a simple main fails with an error about "undefined mainCRTStartup".
But if I use those coming from ldc2 64 bit windows distribution that works perfectly.
$ lld-link /NOLOGO /OPT:REF /OPT:ICF /SUBSYSTEM:WINDOWS /ENTRY:mainCRTStartup\ /errorlimit:0 /OUT:a.exe /LIBPATH:$LP\ /DEFAULTLIB:$DL\ .main.o
with LP either
- /usr/x86_64-w64-mingw32/sys-root/mingw/lib (not working version)
- /home/xx/bin/ldc2-/lib/mingw (copied from the ldc2 win release)
and DL either
- libvcruntime140_app.a (not working version)
- vcruntime140 (ldc2 one)
So I wonder where do your mingw libraries come from ?