Macro function

Source
macro_rules! function {
    (
        $(
            $(extern $($abi:literal)?)? fn $fname:ident( $($atype:ty),* ) $(-> $ret:ty)? = $( ($resolver:path) )? $modname:literal $sep:tt $offset:expr;
        )*
    ) => { ... };
}
Expand description

Creates a function defenition with explicitly defined offset from module or signature.

fn get_address_in_module<const N: usize>(_: ResolveBy<N>) -> usize {
    todo!()
}

memflex::function! {
    extern fn CALLE(i32, i32) -> i32 = "file.exe"#0x1122;

    // Use `get_address_in_module` function to get the address duh
    extern fn OTHER_FN(f32, bool) -> u64 = (get_address_in_module)"file.exe"#0x1122;

    // Resolve by signature
    extern fn SIG_FN() -> u64 = "file.exe"%"4A 5B 3C AA 14";
}