Closed phenax closed 1 year ago
Dumb question: Is something like this possible?
// library.c unsigned int injectable() { return 0; }
// main.rs fn injected_func() -> u32 { 5 } let lib = libloading::Library::new("/path/to/liblibrary.so")?; let func: libloading::Symbol<*mut fn() -> u32> = lib.get(b"injectable"); if let Ok(func) = func { **func = injected_func; }
Defining it as a pointer does the trick
unsigned int (*injectable)() { return 0; }
Dumb question: Is something like this possible?