Skip to main content

interpose

Attribute Macro interpose 

Source
#[interpose]
Expand description

The macro for defining a symbol interposer.

This attribute macro transforms a standard Rust function into an exported symbol (via #[no_mangle]) and automatically resolves the original function from the next available library using dlsym(RTLD_NEXT, ...).

§Parameters

  • symbol: (Optional) The name of the symbol to interpose. Defaults to the function name.

§Example

#[interpose(symbol = "malloc")]
fn my_malloc(size: usize) -> *mut c_void {
    println!("Allocating {} bytes", size);
    call_original!(size)
}