dlhook

Crates.iodlhook
lib.rsdlhook
version0.1.0
created_at2026-01-20 14:39:41.654666+00
updated_at2026-01-20 14:39:41.654666+00
descriptionAn rust proc-macro crate makes write LD_PRELOAD hooks easy.
homepagehttps://github.com/chlorodose/dlhook
repositoryhttps://github.com/chlorodose/dlhook
max_upload_size
id2056710
size4,996
Chlorodose (chlorodose)

documentation

https://docs.rs/dlhook

README

dlhook

An rust proc-macro crate makes write LD_PRELOAD hooks easy.

Usage

Just put #[dlhook(origin = "origin_function_name") on your hook function and receive the "real/origin" function pointer on the first argument. Note that you can(and must!) flag the type of the first function as : _(InferType) so you don't need to repeat yourself.

Example

#[dlhook::dlhook(origin = "getuid")]
fn fake_root_uid(_: _) -> u32 {
    0
}

See more examples at examples/

Commit count: 4

cargo fmt