Skip to main content

code_release

Function code_release 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn code_release(v: *mut CodeValue)
Expand description

The ABI’s required code_release export. Defined here, as a real Rust function, rather than left as whatever runtime.c’s own code_release would otherwise be: cdylib targets get --exclude-libs=ALL from rustc by default, which hides every symbol pulled in from a linked static archive (exactly what build.rs’s cc::Build::compile produces from runtime.c) out of the shared library’s dynamic symbol table — even though this crate’s own code calls it just fine internally. A symbol the crate defines directly (this function) isn’t subject to that exclusion, so renaming the archive’s copy and re-exporting it from here is what makes the host’s dlsym("code_release") actually find it.

§Safety

v must point to a valid, initialized CodeValue — the same requirement runtime.c’s own code_release has. The host only ever calls this on values it deep-copied out of your code_module_dispatch result, so you should never need to call it yourself except via release.