You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A @[c_export] definition is silently dropped when an importer declares the same name extern fn; a bare @[c_export] exports nothing #2554
A module's @[c_export("name")] pub fn name(..) is silently dropped when an importing unit declares extern fn name(..) for the same C symbol; a bare @[c_export] is silently no export at all.
use x.h
use std.builtins.print_i64
extern fn assert_bool(exp: i32, real: i32, line: i32) -> Unit
fn run():
unsafe { assert_bool(1, 2, 7) }
fn main:
run()
print_i64(failures())
with run src/main.w: ld64.lld: error: undefined symbol: _assert_bool. with analyze src/main.w 'select:name~assert_bool' lists only the extern's Sema signature: the module's declaration is gone from the pool, so no MIR body and no definition. Renaming the With function (pub unsafe fn ctest_assert_bool, same @[c_export("assert_bool")]) links and prints 1: the export's definition is only lost when a same-named declaration collides with it.
Expected: the extern declaration and the exported definition name one C symbol; the definition binds it (codegen already does that for a c_import prototype, #1850). Either the colliding declaration resolves to the export, or the collision is a diagnostic. Losing the body silently is the No Silent Fallbacks class.
Also: a bare @[c_export] (no name) compiles and exports nothing (fn_decl_has_c_export reads c_export:<name>); either it means the function's own name or it is refused.
Found wiring STC's ctest.h assertions to a With harness (test/corpora/stc_harness, Phase 3 of docs/proposals/stdlib_sourcing_plan.md); the harness uses distinct With names meanwhile.
Activity
STC corpus (std.stc) and its test lanes: stdlib_sourcing_plan Phase 3…
ehartford commentedon Oct 25, 2026
Triage 2026-10-25,
with v0.15.3.0(main a261b65): reproduced.pre-release: a definition silently disappears (the no-silent-fallbacks class); a collision diagnostic is small.
Frontend: a root extern fn no longer drops the @[c_export] definition…