// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. use deno_core::error::AnyError; use std::mem::size_of; use std::os::raw::c_char; use std::os::raw::c_short; use std::path::PathBuf; mod call; mod callback; mod dlfcn; mod ir; mod repr; mod r#static; mod symbol; mod turbocall; use call::op_ffi_call_nonblocking; use call::op_ffi_call_ptr; use call::op_ffi_call_ptr_nonblocking; use callback::op_ffi_unsafe_callback_close; use callback::op_ffi_unsafe_callback_create; use callback::op_ffi_unsafe_callback_ref; use dlfcn::op_ffi_load; use dlfcn::ForeignFunction; use r#static::op_ffi_get_static; use repr::*; use symbol::NativeType; use symbol::Symbol; pub use call::CallError; pub use callback::CallbackError; pub use dlfcn::DlfcnError; pub use ir::IRError; pub use r#static::StaticError; pub use repr::ReprError; #[cfg(not(target_pointer_width = "64"))] compile_error!("platform not supported"); const _: () = { assert!(size_of::() == 1); assert!(size_of::() == 2); assert!(size_of::<*const ()>() == 8); }; pub const UNSTABLE_FEATURE_NAME: &str = "ffi"; pub trait FfiPermissions { fn check_partial_no_path(&mut self) -> Result<(), AnyError>; #[must_use = "the resolved return value to mitigate time-of-check to time-of-use issues"] fn check_partial_with_path( &mut self, path: &str, ) -> Result; } impl FfiPermissions for deno_permissions::PermissionsContainer { #[inline(always)] fn check_partial_no_path(&mut self) -> Result<(), AnyError> { deno_permissions::PermissionsContainer::check_ffi_partial_no_path(self) } #[inline(always)] fn check_partial_with_path( &mut self, path: &str, ) -> Result { deno_permissions::PermissionsContainer::check_ffi_partial_with_path( self, path, ) } } deno_core::extension!(deno_ffi, deps = [ deno_web ], parameters = [P: FfiPermissions], ops = [ op_ffi_load

, op_ffi_get_static, op_ffi_call_nonblocking, op_ffi_call_ptr

, op_ffi_call_ptr_nonblocking

, op_ffi_ptr_create

, op_ffi_ptr_equals

, op_ffi_ptr_of

, op_ffi_ptr_of_exact

, op_ffi_ptr_offset

, op_ffi_ptr_value

, op_ffi_get_buf

, op_ffi_buf_copy_into

, op_ffi_cstr_read

, op_ffi_read_bool

, op_ffi_read_u8

, op_ffi_read_i8

, op_ffi_read_u16

, op_ffi_read_i16

, op_ffi_read_u32

, op_ffi_read_i32

, op_ffi_read_u64

, op_ffi_read_i64

, op_ffi_read_f32

, op_ffi_read_f64

, op_ffi_read_ptr

, op_ffi_unsafe_callback_create

, op_ffi_unsafe_callback_close, op_ffi_unsafe_callback_ref, ], esm = [ "00_ffi.js" ], );