Cross compilation: Difference between revisions

m
syntax highlighting fixup automation
(Cross compilation in FreeBASIC)
m (syntax highlighting fixup automation)
 
(5 intermediate revisions by 4 users not shown)
Line 2:
Explain the process of creating, for example, a Linux executable binary on a Windows machine, and vice versa.<br>
Include details of any and all compilation and runtime options for incorporating platform-specific elements.<br>
Use the header <nowiki>===baked in===</nowiki> if the standard distribution contains everything needed, or
<nowiki>===third party===</nowiki> if it depends on another toolchain such as GCC and additional setup/installation
for that.<br>
If your language cannot create executable files or is not cross-platform it should be omitted from this task.
 
 
__TOC__
 
=={{header|FreeBASIC}}==
===third party===
The FreeBASIC compiler supports all compilation targets. You only need to install one fbc per host system, and it can be used to compile both native and non-native programs.
 
Line 21 ⟶ 28:
To keep the official FB release packages small, they only include the necessary libraries and tools for native development, but not cross-compiling.
 
{{omit from|J}}
 
{{omit from|Julia}}
=={{header|Pascal}}==
==={{header|Free Pascal}}===
many examples for crosscompiling to different targets.
[https://wiki.freepascal.org/Cross_compiling Cross_compiling Free Pascal]
=={{header|Phix}}==
===baked in===
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 formats PE32 and PE64 for the reverse trick):
<!--<langsyntaxhighlight Phixlang="phix">(phixonline)-->
<span style="color: #000000;">format</span> <span style="color: #000000;">ELF32</span>
<span style="color: #008080;">include</span> <span style="color: #000000;">p</span><span style="color: #0000FF;">.</span><span style="color: #000000;">exw</span>
<!--</langsyntaxhighlight>-->
The platform() and machine_bits() builtins can be explictly used as runtime tests to vary code by platform.
The compiler tries hard to avoid emitting 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
Line 41 ⟶ 54:
compiler directive "with javascript_semantics" explicitly stating that is possible, and the "without"
variant explicitly blocking it, with similar implications as requires().
The former also triggers runtime errors on desktop/Phix should incompatible operations be attempted, most
most notably use of copy-on-write semantics, and hence effectively/conversely Javascript's pass -by -sharing, and: also
addressing any such problem statements on desktop/Phix implicitly also ensures they will work in a browser.
The transpiler(/syntax colouring) also populates rosettacode with the otherwise hidden tags "(phixonline)" when javascript compatible and
"javascript compatible and (not<nowiki>online</nowiki>)" when not, the results of searching for which can be seen
''[https://www.rosettacode.org/mw/index.php?title=Special%3ASearch&search=phixonline here]'' and
''[https://www.rosettacode.org/mw/index.php?title=Special%3ASearch&search=notonline here]'' respectively.
 
=={{header|Wren}}==
===third party===
Wren is basically a scripting language which lives inside a host application in the form of a virtual machine (VM). The host application communicates with the VM via the embedding API which (like the VM itself) is written in C99.
 
10,333

edits