pub unsafe fn call<R: CType>(fun: CodePtr, args: &[Arg<'_>]) -> RExpand description
Performs a dynamic call to a C function.
To reduce boilerplate, see ffi_call!.
ยงExamples
extern "C" fn hypot(x: f32, y: f32) -> f32 {
(x * x + y * y).sqrt()
}
use deno_libffi::high::call::*;
let result = unsafe {
call::<f32>(CodePtr(hypot as *mut _), &[arg(&3f32), arg(&4f32)])
};
assert!((result - 5f32).abs() < 0.0001);