The definition lands BEFORE the protocol declares the export. logos-protocol
only DECLARES the module-impl C ABI and every backend owes the definition;
that gap shipped twice, each time as an undefined symbol at dlopen, on Linux
only, invisible on macOS. Declaring first would turn this repo, logos-rust-sdk
and logos-module-builder red the night the bump merged. Defining first costs
nothing: the guard is MAJOR-aware >= 0.6 and the current pin is 0.5, so
nothing is emitted today and the ABI check sees declared == defined.
This is the case #146 made possible. The next-MAJOR probe resolves the
emitter at MAJOR+1, where a >= 6 guard IS true, so the emitted set there is
legitimately a SUPERSET of the declared one. The probe used to demand
equality and would have rejected this outright.
cpp/logos_caller.h carries the LogosCaller type (std-typed, Qt-free) and
logos::currentCaller(), reading a thread-local stack the generated export
pushes to.
Two things the audit corrected, both worth reading:
* A present-but-unreadable `instance` is DROPPED and the module still
identified. This backend already did that; Rust returned Unknown, and each
had a passing test pinning its own answer, so neither suite could see the
divergence. The protocol header now states the rule normatively and Rust
is aligned to it.
* The accessors are explicitly HIDDEN on ELF. The header argued this state
must not be unified across images and then relied on being inline to
achieve it — which is false: a function-local static in an inline function
emits STB_GNU_UNIQUE at default visibility and the loader collapses every
image's copy into one, even under RTLD_LOCAL. Measured across two dlopen'd
images: default visibility let a push in A be read by B; hidden restored
isolation. logos-module-builder sets no visibility anywhere, so real
plugins were built the first way. An anonymous namespace would be worse —
vague linkage is load-bearing WITHIN an image, since the generated TU
pushes and the author's TU reads.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>