Re:Main is usually a function, so when is it not? (2015)
by Deestan on Sunday September 10, 2017 @06:55PM
(#15214741)
Unless the assignment in question specifies architecture, the TA could (should? I know I would) run it on a 32 bit Windows environment and mark it down for not working.
[ Parent
| on HN ]
Re:Main is usually a function, so when is it not? (2015)
by userbinator on Sunday September 10, 2017 @07:21PM
(#15214849)
Not surprisingly, there are tricks one can use to figure out what the environment is, using the same binary; start here:
https://stackoverflow.com/questions/38063529/x86-32-x86-64-p...
...and if you want to expand it to run on a SPARC or MIPS or something else...
https://hackaday.io/project/18614-polyglot-one-binary-multip...
The general idea is to find a set of bytes which can be interpreted in different (and valid) ways by all the architectures you want to support, and using those differences, jump to architecture-specific code.