summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/shared-libs.md7
-rw-r--r--docs/typ/building.typ1
-rw-r--r--src/Addon.zig1
3 files changed, 6 insertions, 3 deletions
diff --git a/docs/shared-libs.md b/docs/shared-libs.md
index f6031a0d..73d6a73a 100644
--- a/docs/shared-libs.md
+++ b/docs/shared-libs.md
@@ -46,9 +46,10 @@ addons compiled in: image.zig as a module, its stb_image static in stb.c
beside the binary's zstbi resize, and pdf.zig with MuPDF, its FreeType and
zlib (the module exports `pardes_addon` only from its library, so the static
binary reads its declaration), so the binary holds one copy of each. Addon.zig registers both at start as if
-loaded. It loads no library (a static binary has no dlopen); it is also
-the way a build for macOS, whose loader has no memfd, could have image and
-PDF panes.
+loaded. It loads no library (a static binary has no dlopen, and `Addon
+load` says `not on this platform`). `zig build static -Dplatform=gui` is
+the window's, linked dynamically with both addons in. Every build off Linux
+is built this way too, since Addon.zig's loader is a Linux memfd.
## PDF panes became an addon (2026-11-06)
diff --git a/docs/typ/building.typ b/docs/typ/building.typ
index 151d4b3f..61641cba 100644
--- a/docs/typ/building.typ
+++ b/docs/typ/building.typ
@@ -30,6 +30,7 @@ MuPDF is compiled only for the steps and tests that use `pdf.so`.
[`zig build -Dplatform=gui`], [the SDL3 window alone],
[`zig build -Dplatform=macos`], [an AppKit and CoreText app over a static `libpardes.a` (`docs/macos.md`)],
[`zig build static -Dplatform=tui -Dtarget=x86_64-linux-musl`], [one statically linked `pardes` with the image and PDF addons compiled in (`/addons` lists them `builtin`); musl's, as glibc links only dynamically, and never the default],
+ [`zig build static -Dplatform=gui`], [`pardes-gui` with the two addons compiled in, linked dynamically (SDL and the GPU take the display's libraries)],
)
A bare `zig build` installs into the prefix (`zig-out`, or `--prefix
diff --git a/src/Addon.zig b/src/Addon.zig
index 209c761a..d39a27f3 100644
--- a/src/Addon.zig
+++ b/src/Addon.zig
@@ -112,6 +112,7 @@ fn read(data: []const u8, path: []const u8, words: *[64]LoadedWord, why: *Why) L
/// (dlopen hands back the handle it has for a path it has), unless this
/// process holds those very bytes already.
fn hold(path: []const u8, hash: *[32]u8, why: *Why) ?*Lib {
+ if (comptime compiled_in.len > 0) return failNull(why, "not on this platform: its addons are compiled in", .{});
var z: [4096]u8 = undefined;
const path_z = std.fmt.bufPrintSentinel(&z, "{s}", .{path}, 0) catch return failNull(why, "the path is too long", .{});
const f = std.c.fopen(path_z, "r") orelse return failNull(why, "cannot read it", .{});