summaryrefslogtreecommitdiff
path: root/test_ffi/src
diff options
context:
space:
mode:
authorAapo Alasuutari <aapo.alasuutari@gmail.com>2022-09-05 06:26:52 +0300
committerGitHub <noreply@github.com>2022-09-05 08:56:52 +0530
commit16dbf4adc390c9fb7656372b42811c1929e755dd (patch)
treebff7c876c97e5eb56d2d08de0198fe7640ddb031 /test_ffi/src
parent08a6af398fd92517193e20117f9971c272b1bb5f (diff)
feat(ext/ffi): Support bool FFI type (#15754)
Diffstat (limited to 'test_ffi/src')
-rw-r--r--test_ffi/src/lib.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/test_ffi/src/lib.rs b/test_ffi/src/lib.rs
index 08ef7cb7f..812b563ef 100644
--- a/test_ffi/src/lib.rs
+++ b/test_ffi/src/lib.rs
@@ -95,6 +95,11 @@ pub extern "C" fn add_f64(a: f64, b: f64) -> f64 {
}
#[no_mangle]
+pub extern "C" fn and(a: bool, b: bool) -> bool {
+ a && b
+}
+
+#[no_mangle]
unsafe extern "C" fn hash(ptr: *const u8, length: u32) -> u32 {
let buf = std::slice::from_raw_parts(ptr, length as usize);
let mut hash: u32 = 0;
@@ -258,6 +263,9 @@ pub extern "C" fn call_stored_function_thread_safe_and_log() {
pub extern "C" fn nop() {}
#[no_mangle]
+pub extern "C" fn nop_bool(_a: bool) {}
+
+#[no_mangle]
pub extern "C" fn nop_u8(_a: u8) {}
#[no_mangle]
@@ -297,6 +305,11 @@ pub extern "C" fn nop_f64(_a: f64) {}
pub extern "C" fn nop_buffer(_buffer: *mut [u8; 8]) {}
#[no_mangle]
+pub extern "C" fn return_bool() -> bool {
+ true
+}
+
+#[no_mangle]
pub extern "C" fn return_u8() -> u8 {
255
}