What's New in v0.8.3

This release was driven entirely by binding real C libraries and fixing whatever GX couldn’t express. Every change here was justified by a working binding hitting a concrete wall.

New modules

Four new bindings ship in modules/:

ModuleWrapsSmoke test
enetlsalzman/enet 1.3.18 (UDP networking)server/client packet round-trip
threadingWin32 threads or pthread + atomics8 threads × 100k atomic incs
sdl3SDL 3.2.18 (window, events, renderer)open window, animate rect, exit
cimguiDear ImGui v1.92.7 via cimguicreate / destroy ImGuiContext

The sdl3 and cimgui modules ship vendored upstream sources. enet and threading use a small standalone C glue file each.

Compiler additions

Pointer-friendly basics

var p: *void = null              // null literal — assignable to any *T
var raw: *void = (*void)cstr     // pointer cast syntax
var ports: *Connection[16]       // *T[N] now means "array of N pointers"

null, (*T)expr casts, and the *T[N] reading match what most C programmers expect — the previous behavior surfaced as friction in real bindings.

c_int ↔ i32 is now seamless

extern fn rand:c_int()
var r: i32 = rand()              // works in both directions
if (rand() > 0) { ... }          // c_int compares with i32 literals

Same for c_uint ↔ u32 and a few other same-width pairs.

@c_imported — share types with included headers

When a @c_included C header already defines a struct, union, enum, or constant, mark the GX-side declaration @c_imported. GX type-checks against your declared layout but emits no typedef in the output C — the upstream header is the single source of truth.

@c_include("enet/enet.h")

@c_imported
extern struct ENetAddress {
    host: u32
    port: u16
}

@c_imported
const ENET_HOST_ANY: u32 = 0

This solves the typedef struct _Foo {...} Foo collision pattern that many older C libraries use (enet, OpenSSL, Lua, sqlite3, classic POSIX).

@cppfile — bind C++ libraries

@compiler("clang")
@cppfile("../c/imgui/imgui.cpp")
@cppfile("../c/cimgui.cpp")
@c_include("cimgui.h")

Compiles .cpp / .cxx / .cc sources alongside the GX-generated C. clang dispatches by file extension; presence of any @cppfile forces a clang-capable compiler. Used for cimgui, but works for any C++ library with a C wrapper.

Editor support

The IntelliJ plugin recognizes @cppfile and @c_imported (lexer + autocomplete + quick-doc). VSCode and any LSP-aware editor pick them up automatically — vscode-gx’s syntax highlighting matches @-directives generically, and the LSP server delegates parsing to the upstream compiler binary.

Upgrade path

Upgrading from 0.8.2 needs no source changes — every fix is additive. A few patterns become available that you can opt into:

  • Replace var p: *void (zero-init) with the more explicit var p: *void = null
  • Replace cstr → void cast shims with native (*void)expr casts
  • For new bindings, prefer @c_imported + @c_include over standalone glue headers
  • Move from *T wrapper structs to native *T[N] arrays of pointers

The existing modules (raylib, sokol, json, etc) build unchanged.

Where to look

  • docs/05_C_Interop.md — @c_imported reference
  • docs/08_Compile_Time.md — @cppfile and other build directives
  • docs/24_C_ABI_Friction_Report.md (in the repo) — the data-driven story of which signals drove which fixes