How jart/cosmopolitan works
Cosmopolitan is a portable C/C++ runtime and executable format: users build programs with the external cosmocc toolchain, then run the resulting polyglot executable natively across supported operating systems. The repository tree shows the APE loader, libc facilities, DSP support, and several user-facing programs. README statements establish the portability and debugging workflow; source excerpts support the Plinko entry point and selected network utilities. Many subsystems are represented only by the tree, so their internal call paths are not asserted.
Main entry points: runtime.h Process runtime · ape-m1.c APE executable format · loader.c APE loader · client.c Encrypted chat client
Components 21
Executable portability
- APE loader
ape/loader.c - APE executable format
ape/ape-m1.c
Libc runtime
- OS system calls
libc/calls/calls.h - Process runtime
libc/runtime/runtime.h - Windows compatibility
libc/isystem/windowsesque.h - String library
libc/str/str.h - Thread contexts
libc/thread/makecontext.c
DSP and terminal
- DSP primitives
dsp/core/core.h - Audio I/O
dsp/audio/audio.c - MPEG decoder
dsp/mpeg/pl_mpeg.c - Image scaling
dsp/scale/scale.c - Terminal graphics
dsp/tty/tty.h
Programs and tools
- HTTP escaping
net/http/escape.h - Encrypted chat server
tool/chat/server.c - Encrypted chat client
tool/chat/client.c - HTTP server
net/turfwar/turfwar.c - DNS query utility
tool/net/libresolv_query.c - Plinko interpreter
tool/plinko/main.c
Other components
- Program developer
- cosmocc toolchain
- Supported operating systems
Connections 15
- Program developer → cosmocc toolchain: builds with
- cosmocc toolchain → APE executable format: emits executable
- Program developer → APE executable format: runs program
- APE executable format → APE loader: loads through
- APE loader → Process runtime: starts runtime
- Process runtime → OS system calls: provides OS calls
- APE executable format → Supported operating systems: runs natively on
- Process runtime → Windows compatibility: supports Windows API
- Process runtime → Thread contexts: provides contexts
libc/thread/makecontext.c - Encrypted chat server → HTTP escaping: uses escaping
tool/chat/server.c - Encrypted chat client → HTTP escaping: uses escaping
tool/chat/client.c - Program developer → Encrypted chat client: runs chat client
- Program developer → HTTP server: runs server
- Program developer → DNS query utility: runs query tool
- Program developer → Plinko interpreter: runs interpreter
tool/plinko/main.c