darfink / detour-rs

A cross-platform detour library written in Rust
Other
406 stars 75 forks source link

initialize returning ()? #1

Closed GrahamBest closed 7 years ago

GrahamBest commented 7 years ago
    let mut hook = unsafe {
        DetourStruct.initialize(createmove_hook, closure_for_createmove);
    };

Seems to return a (). Therefore I can't access any elements.

static_detours! {
    struct DetourStruct: fn(f32, *mut UserCmd) -> bool;
}

Heres my detour struct. Thanks!

darfink commented 7 years ago

It's due to your use of semicolon, notice the difference:

    let mut hook = unsafe {
        DetourStruct.initialize(createmove_hook, closure_for_createmove) // <-- here
    };
GrahamBest commented 7 years ago

Wow, I'm really dumb. Thanks for this!!! I got it alll figured out :)