Cross compilation: Difference between revisions

m
→‎{{header|Phix}}: PE32/64 note, sp
m (→‎{{header|Phix}}: PE32/64 note, sp)
Line 6:
A simple format directive in the source allows for easy cross-compilation to any other supported system, for
instance the Linux binaries of Phix are always compiled on Windows by throwing the following at "p -c -norun p32.exu"
(with a similar p64.exu for 64bit, and the formats PE32 and PE64 for the reverse trick):
<!--<lang Phix>(phixonline)-->
<span style="color: #000000;">format</span> <span style="color: #000000;">ELF32</span>
Line 12:
<!--</lang>-->
The platform() and machine_bits() builtins can be explictly used as runtime tests to vary code by platform.
The compiler tries hard to avoid omittingemitting unnecessary binary, which is likely to be more successful when those routines are used as plainly as possible, without any and/or parts to the conditional. Likewise #ilASM{} aka inline assembly can contain guards
such as [32] to emit (only) the relevant code for different target architectures, see
[[Conditional_structures#ilASM]] and [[Pragmatic_directives#Phix]] for more details and examples.
7,796

edits