-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for c_variadic #10
Comments
I wasn't aware of c_variadics were supported in Rust, but I found that's it's available under a nightly feature. I'll look into adding it. It may require a lot more than just updating the macro, but I'd have to look more into c variadics before I know for sure. |
As a work-around, using a RawDetour with a C-variadic function works, though brings the drawback of transmuting back the trampoline function back whenever you call it. That said, I would appreciate C-variadic support as well for the two C-variadic detours I have in place in my project. |
Sorry about that, I have a branch that I was working on adding support. Though, updating the In the meantime, the branch has added trait implementations for c-variadics so it can be used with GenericDetour. You can update your current project to use the latest commit from the branch: [patch.crates-io]
# a83e075 is the latest commit of the `c-variadics` branch
retour = {git = "https://github.com/Hpmason/retour-rs", rev = "a83e075"}
[dependencies]
# Add the new "c-variadic" feature to enable C variadics
retour = {version = "0.3.0", features = ["static-detour", "c-variadic"]} I'll try to take another stab at the Edit: Updated rev since I forgot to impl Function for all variadics, not just |
So, I've hit the limitations of Rust's c-variadics. We can't properly implement I'm not really sure if there is a way to properly support variadics atm. We sadly can't use Rust's Fn traits directly since they aren't implemented for unsafe functions, limiting a lot of use cases. |
Using varargs in a detour causes a recursion crash:
The text was updated successfully, but these errors were encountered: