Skip to content

Native Executables

Derek Snider edited this page May 19, 2026 · 2 revisions

Native Executables

madc can generate standalone native Linux ELF executables from your programs.

Basic usage

madc -o program program.mad
./program

The output is a real native binary — no runtime dependency on madc.

How it works

When you pass -o, madc compiles your program to x86-64 machine code (just like JIT mode) but writes the result as an ELF executable instead of running it in-process. The same asmjit backend is used for both modes.

Multi-file projects

madc -o myapp myapp.mad

All #included files are compiled together into a single binary.

EXE parity

The native executable lane is kept in sync with JIT mode. Both modes pass the same integration test suite (287/287 as of the latest build). When a test passes in JIT, it should also pass as a native executable.

libmadc dependency

Native executables link against libmadc.so for runtime support (string operations, namespace functions, etc.). To run the executable:

sudo make -C src install-libmadc    # install libmadc.so to /usr/local/lib
LD_LIBRARY_PATH=/usr/local/lib ./program

What's next?

Clone this wiki locally