Skip to main content

validate_extern_signature

Function validate_extern_signature 

Source
pub(crate) fn validate_extern_signature(
    abi: &Abi,
    attrs: &[Attribute],
    inputs: &Punctuated<FnArg, Comma>,
    output: &ReturnType,
) -> Result<()>
Expand description

Validate the signature of an extern "C-unwind" fn exported via #[miniextendr].

R’s .Call interface passes all arguments as SEXP and expects a SEXP return value. For extern "C-unwind" functions the user writes the C symbol directly, so the signature must satisfy those invariants statically — otherwise the generated registration produces UB at runtime.

Called before any codegen so we fail fast on an invalid extern signature rather than emitting a wrapper that would only matter after the error.