On Monday, 17 May 2021 at 11:08:33 UTC, Raimondo Mancino wrote:

My guess is that we could produce a portable executable with Cosmopolitan and thus write something like this in our hello.d:

```d
/* I am not sure how would we compile this, but
 * I guess it's going to be something like:
gdc -g -O -static \
  -fno-pie -fuse-ld=bfd -mno-red-zone
  -fno-druntime
  -o hello.com hello.d
-Wl,--oformat=binary -Wl,--gc-sections -Wl,-z,max-page-size=0x1000 -fuse-ld=bfd \
  -Wl,-T,ape.lds
  crt.o ape.o cosmopolitan.a
 */

What do you think about it?

The command would be pretty much the same as gcc (`-nostdinc -nostdlib`), but instead of `-include cosmopolitan.h`, you'd pass a cosmopolitan binding module (importC may solve the need for that), and a minimal (possibly empty) object.d to satisfy the compiler's need to have an object module.

Reply via email to