RGFW: Single-header C99 window abstraction library

Single-header design and compilation

  • Many commenters like single-header C libraries for ease of integration and modularity: drop in one file, no build‑system friction.
  • Others argue the “single-header” pattern is overused; traditional .h/.c splits give clearer encapsulation and avoid needing special macros.
  • Several clarify correct usage: define a single FOO_IMPLEMENTATION in exactly one translation unit to avoid multiple definitions. Some people create a tiny .c file that only defines the macro and includes the header.
  • Concerns about compilation speed are debated. For RGFW’s ~287 KB header, measured compile times are under a second on typical hardware; some say “slow single-header builds” are mostly hypothetical for code this size.

What “single-header” really means

  • There’s debate over “true single-header” vs libraries that are merely concatenated sources.
  • One side emphasizes STB-style goals: compact, minimalist design intentionally built for single-header distribution.
  • Others counter that if it’s one header and documented as such (e.g., Nuklear), it is a single-header library; the distinction is seen as subjective.

Platform and backend support (Wayland, X11, mobile)

  • Wayland support in RGFW is acknowledged as experimental and currently broken. Multiple users see this as a major drawback, especially for minimal SDL alternatives.
  • Wayland is widely described as hard to target in a header-only lib due to required code generation and low‑level, awkward APIs. Some point to hand-written minimal Wayland clients as references.
  • X11 is viewed as mature but problematic for modern multi‑monitor and scaling setups; Wayland fixes some things but introduces others.
  • Mobile (Android) support is requested; author indicates interest but low priority and possibly a separate branch.

Scope vs minimalism (RGFW, GLFW, SDL, Rust crates)

  • RGFW aims to be much smaller than GLFW while offering similar windowing features. “Minimal” refers to code size, not necessarily feature surface.
  • SDL is criticized as non‑minimal because it bundles image loading, audio, font rendering, networking, and a graphics abstraction layer.
  • Rust ecosystem equivalents (miniquad, pixels, minifb, softbuffer) are mentioned; they’re seen as useful but often lack some features of GLFW/RGFW.

Tooling, package managers, and dependencies

  • Some argue single-header libraries exist partly because Windows historically lacked a standard C/C++ package manager and standard header/library locations.
  • Others respond that:
    • OS package managers are ill‑suited for cross‑platform C/C++ dependencies.
    • Modern languages mostly avoid OS-level package managers for dependencies.
    • Single-header libs are useful regardless of package manager availability.
  • There’s disagreement on how much default availability of tools like winget affects adoption; some see “too many choices” as a barrier, others downplay it.

Portability, integer types, and MSVC quirks

  • A Windows type bug is spotted: typedef signed long i64 is only 32‑bit on Windows (LLP64), potentially clashing with user code expecting a true 64‑bit i64.
  • Commenters recommend using C99’s stdint.h (int64_t, etc.) and, if desired, aliasing these to short names.
  • Historical MSVC compatibility concerns around stdint.h are mentioned, but others note that since at least VS 2010–2015 it’s fine and widely used in cross‑platform headers.