Macro ext_php_rs::zend_fastcall
source · zend_fastcall!() { /* proc-macro */ }
Expand description
Defines an extern
function with the Zend fastcall convention based on
operating system.
On Windows, Zend fastcall functions use the vector calling convention, while on all other operating systems no fastcall convention is used (just the regular C calling convention).
This macro wraps a function and applies the correct calling convention.
§Examples
use ext_php_rs::zend_fastcall;
zend_fastcall! {
pub extern fn test_hello_world(a: i32, b: i32) -> i32 {
a + b
}
}
On Windows, this function will have the signature pub extern "vectorcall" fn(i32, i32) -> i32
, while on macOS/Linux the function will have the
signature pub extern "C" fn(i32, i32) -> i32
.
§Support
The vectorcall
ABI is currently only supported on Windows with nightly
Rust and the abi_vectorcall
feature enabled.