From 62291e9b0e99406ac7f5a95dc329400f9f966825 Mon Sep 17 00:00:00 2001 From: DjDeveloper <43033058+DjDeveloperr@users.noreply.github.com> Date: Wed, 12 Jan 2022 17:08:26 +0530 Subject: feat(ext/ffi): UnsafeFnPointer API (#13340) --- test_ffi/src/lib.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test_ffi/src') diff --git a/test_ffi/src/lib.rs b/test_ffi/src/lib.rs index 93b274b4b..a04c2c2fd 100644 --- a/test_ffi/src/lib.rs +++ b/test_ffi/src/lib.rs @@ -1,5 +1,6 @@ // Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. +use std::os::raw::c_void; use std::thread::sleep; use std::time::Duration; @@ -101,3 +102,13 @@ pub extern "C" fn nonblocking_buffer(ptr: *const u8, len: usize) { let buf = unsafe { std::slice::from_raw_parts(ptr, len) }; assert_eq!(buf, vec![1, 2, 3, 4, 5, 6, 7, 8]); } + +#[no_mangle] +pub extern "C" fn get_add_u32_ptr() -> *const c_void { + add_u32 as *const c_void +} + +#[no_mangle] +pub extern "C" fn get_sleep_blocking_ptr() -> *const c_void { + sleep_blocking as *const c_void +} -- cgit v1.2.3