Module call

Module call 

Source
Expand description

Simple dynamic calls.

This API allows us to call a code pointer with an array of arguments, using libffi to set up the call.

§Examples

extern "C" fn hypot(x: f32, y: f32) -> f32 {
    (x * x + y * y).sqrt()
}

use deno_libffi::ffi_call;

let result = unsafe { ffi_call!{ hypot(3f32, 4f32) -> f32 } };

assert!((result - 5f32).abs() < 0.0001);

Re-exports§

pub use middle::CodePtr;

Structs§

Arg
Encapsulates an argument with its type information.

Functions§

arg
Constructs an Arg for passing to call.
call
Performs a dynamic call to a C function.