Closed notwa closed 1 month ago
hmm hold on, this should be adjusted to reopen stdin and stdout as binary as well, for the tools that don't take arguments (b2m, m2b, etc)
According to https://www.man7.org/linux/man-pages/man3/freopen.3p.html#APPLICATION_USAGE using freopen
to set binary mode has quirks, so I opted to use win32 API functions instead. AFAIK this only affects Windows (mingw) so I think it's fair to only attempt this on the platform. Everything seems to be working now; I cascaded a C file through each process and didn't experience any corruption.
Thank you for addressing Windows issues.
It is hard to make Windows port. I spent a lot of time on this but finally gave up. The biggest problem I saw is setjmp/longjmp implementation which requires to generate very specific function prologs/epilogs. Otherwise setjmp/longjmp will never work. Unfortunately documentation about prologs/epilogs on Windows is very brief and not clear.
This fixes newline-conversion issues on Windows. Otherwise, I'm not able to run compiled files. This does not change
fopen
s that appear to be only used for text files.