Make WASI and w2c2_base.h compile on MSVC 4.0 #101
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why MSVC 4.0 specifically? Mostly because it's the only compiler that I'm aware of that can target the RISC versions of Windows NT 4.0 (yes, there were official versions for MIPS, PowerPC and Alpha).
Generated code will still not compile with it though, as there's nolong long
type in MSVC4. You can replace allLL
suffixes withi64
though, around c.c:1049:w2c2/w2c2/c.c
Lines 1047 to 1050 in 22a9ade
The only reason that I didn't include it in this PR is that I wasn't able to find a way to add a type toggle switch while making the code pretty.(UPDATE: Made aW2C2_LL
macro, no need for this anymore.)There's still stuff to do to get the generated code to work completely with MSVC4, such as finding workarounds to the following errors:
error C2520: conversion from unsigned __int64 to double not implemented, use signed __int64
fatal error C1053: 'fXXXX' : function too large
Also, while not exactly fatal, the endianness check fails on MIPS for some reason (untested on PowerPC and Alpha).
Those errors come from the Python example, although I was able to get the ls and Rust examples working from the current patches.