logoalt Hacker News

DavidPipertoday at 7:20 AM1 replyview on HN

Assembly for the correct architecture is only one part of getting an executable running on a machine.

- Dynamic libraries (e.g. for calling into the kernel, but also user space dynamic libraries) are OS-specific (.so for Linux, .dylib for macOS, .dll for Windows)

- Executable format is OS-specific (ELF for Linux, Mach-O for macOS, PE for Windows)

- Dynamic loading and linkage of both the above are also therefore OS-specific


Replies

gsliepentoday at 10:22 AM

And even if you avoid external libraries, you still need to interact with the kernel to do I/O, and that involves system calls that are also non-portable.