| Crates.io | dlhook |
| lib.rs | dlhook |
| version | 0.1.0 |
| created_at | 2026-01-20 14:39:41.654666+00 |
| updated_at | 2026-01-20 14:39:41.654666+00 |
| description | An rust proc-macro crate makes write LD_PRELOAD hooks easy. |
| homepage | https://github.com/chlorodose/dlhook |
| repository | https://github.com/chlorodose/dlhook |
| max_upload_size | |
| id | 2056710 |
| size | 4,996 |
An rust proc-macro crate makes write LD_PRELOAD hooks easy.
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.
#[dlhook::dlhook(origin = "getuid")]
fn fake_root_uid(_: _) -> u32 {
0
}
See more examples at examples/