cwist
Modern C web framework with libttak runtime
Loading...
Searching...
No Matches
platform.h File Reference

Target capability macros shared by all CWIST sources. More...

#include <cwist/sys/wasi.h>
Include dependency graph for platform.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define CWIST_PLATFORM_HOSTED   1
 

Detailed Description

Target capability macros shared by all CWIST sources.

Guards test what the target provides instead of which toolchain built it, so a new target (bare metal, issue #447) only has to define its row here:

  • CWIST_PLATFORM_HOSTED: a native POSIX host (Linux, macOS, BSD) with processes, signals, rlimits, threads, a filesystem and sockets. The server-only subsystems (listen loop, worker pool, HTTPS/H2/H3, static file cache, nuke DB) compile only here.
  • CWIST_PLATFORM_NO_PROC: no fork(2), signals, rlimits, getpid() or threads (WASI and bare metal). Emscripten keeps its own guards.
  • CWIST_PLATFORM_NO_SOCKETS: no BSD socket API; requests reach the app through cwist_app_dispatch_memory() only (WASI sysroots without wasi:sockets, and bare metal).
  • CWIST_BAREMETAL: no OS at all (arm-none-eabi + newlib on Cortex-M). Inferred for ARM EABI toolchains that define no OS macro; pass -DCWIST_BAREMETAL to force it elsewhere. The firmware supplies the hooks declared in <cwist/sys/port.h>.

WASI flavour detection (CWIST_WASI_SOCKETS / CWIST_WASI_NO_SOCKETS) stays in <cwist/sys/wasi.h>; guards that select a WASI-only API (getentropy via wasi-libc, wasi:sockets quirks) keep testing it or wasi directly.

Definition in file platform.h.

Macro Definition Documentation

◆ CWIST_PLATFORM_HOSTED

#define CWIST_PLATFORM_HOSTED   1

Definition at line 38 of file platform.h.