fn_has_this
A proc attribute macro that adds a this
argument to a function.
This macro is well suited for conditional compilation. For example, some compilers will optimize away a this
argument in a non-static function if it is unused, sometimes depending on calling convention. This macro makes it easy to conditionally compile your Rust programs to interact over FFI with functions compiled in this way.
```rust
extern crate fnhasthis;
use core::ffi::c_void;
this
in the functionpub unsafe extern "fastcall" fn print_pointer() { println!("{:x?}", this); }
this
argumentpub unsafe extern "thiscall" fn print_pointer() { println!("{:x?}", me); }
cfg_attr
, you can conditionally compile this attribute macropub unsafe extern "thiscall" fn print_pointer() { println!("{:x?}", me); } ```