#help
17 messages · Page 1 of 1 (latest)
what are you doing?
how does hook_callback looks like?
my guess is that you don't need &mut self
that seems to be the difference between your function and what the callback expects
is this the function?
you have to match that function signature exactly
that is what the system expects
adding or removing arguments is not something you're allowed to do
I'm not on windows to check it out well
my guess is that if you want to keep state between calls, you need a static/thread local variable
I don't see any other way you could make this work
why can't you define a static var?
you can have a struct with some data that is static that you access from all the functions
struct MyStuff {
x: i32,
y: i32,
}
static mut CTX: MyStuff = MyStuff { x: 0, y: 0 };
fn main() {
unsafe { CTX.x = 5; }
}
disclaimer: ^ not 100% safe if multiple threads are involved
it's not pretty, but windows doesn't give you another option in this case