Home /Modules/web-server-technology/PORTABILITY.md

PORTABILITY.md

lib/web-server-technology/PORTABILITY.md · 94 line(s) · markdown

slweb portability

The slweb library (C11 core + C++17 facade) is intentionally dependency-free: no sockets, no HTTP wire handling, just the C and C++ standard libraries plus one tiny per-platform call for the CPU count. This document is an honest per-target assessment.

What is and is not platform-specific

Target matrix

TargetC core (slweb.c, C11)C++ facade (slweb.hpp, C++17)
Linux (x86-64/arm64)Yes — built and tested hereYes — GCC/Clang
macOS (Intel + Apple Silicon)Yes — sysconf is nativeYes — Apple Clang ≥ 10 (Xcode 10, 2018)
Windows 11 / 10 / 8 / 7Yes — GetSystemInfo is on every versionYes — MSVC 2017+ (/std:c++17) or MinGW-w64 GCC ≥ 7
Windows XPYes, as C11 with an old compilerNo — see below

macOS

Builds as-is with the shipped Makefile:

cd lib/web-server-technology
make        # clang produces build/libslweb.a and build/libslweb++.a
make test

Apple Clang has shipped C++17 since Xcode 10 (2018); <optional> and the rest of the facade are available on every currently-supported macOS.

Windows 7 through 11 (and newer)

Supported. The C and C++ paths both compile; the Windows branch of slweb_warm_core_count uses GetSystemInfo, which exists on every Windows version. Two toolchains work:

A windows Makefile target automates the MinGW-w64 cross-build (from Linux or macOS) into build/win/:

make windows                       # x86-64 Windows libs (build/win/libslweb*.a)
make windows MINGW=i686-w64-mingw32 # 32-bit
make windows-test                  # also build the smoke-test .exe files

It auto-detects the toolchain and prints an install hint if MinGW-w64 is absent. The equivalent manual commands:

x86_64-w64-mingw32-gcc  -std=c11   -O2 -c native/src/slweb.c   -Inative/include -o slweb.o
x86_64-w64-mingw32-g++  -std=c++17 -O2 -c cpp/src/slweb.cpp    -Inative/include -Icpp/include -o slweb_cpp.o
x86_64-w64-mingw32-ar   rcs libslweb.a  slweb.o

The Windows (_WIN32) code path has been syntax/type-checked on the build host (forcing the branch with a minimal windows.h shim and -fsyntax-only, clean under -Wall -Wextra). It has not been linked into a running .exe in this environment — there is no MinGW cross-compiler or Windows host here, so treat "builds on Windows" as verified at the compile level and pending a real Windows/MinGW build for link + run confirmation.

Windows XP (the one hard limit)

Note on the server vs. the library

This matrix is for the library only. The standalone server (web-server-technology/native/*) uses POSIX sockets, poll, and threads and is a POSIX/Linux/macOS artifact (its grades already report the Win32/Winsock limitation at runtime). The library was kept socket-free precisely so it can be embedded anywhere, including Windows, without that constraint.