Closed mrexodia closed 5 years ago
Passing st_emulator twice is because Windows command line handling is quite messy, so I'd rather be as explicit as possible.
But you're absolutely right about the %s. Turns out Flips 1.31 uses msvcrt's printf, which doesn't quite follow the standards, while modern mingw prefer a builtin printf implementation.
%ls works on both, and I've seen msvcrt get closer to standards compliance (for example, it learned %zu in Windows 7 - Vista and older only understand %Iu), so this is an improvement. Thanks.
Now to switch it back to msvcrt - the builtin printf demands libgcc_s_sjlj-1.dll nearby, which fits poorly with my preference of having Flips be a single standalone .exe. Thanks for bringing that to my attention.
For me mingw-w64 doesn't link to any non-system libraries without source modifications. See https://ci.appveyor.com/project/mrexodia/flips/build/job/ipy6ba5evfum2lcb/artifacts
It should just statically link mingw-w64's printf implementation...
That's a 64bit build. This extra DLL only shows up on 32bit, and may depend on other mingw-w64 config too (both exception model and threading style affect the number of DLLs, or at least did last time I checked).
While I prefer static links over extra DLLs, I also like keeping my binaries small. There's no reason to include 70KB of printf code if I don't need it.
The
swprintf
function takes the%s
format specifier to mean aconst char*
, so the final output incmdline
would be"C" "C"
. I explicitly specify%ls
to meanwchar_t*
and this fixes the issue. I am not sure if this is an issue specifically with mingw-w64 8.1.0, but%ls
is always correct regardless.Additionally I removed the emulator path from the first CreateProcess argument since it does not do anything (your command line already contains which process to launch).