summaryrefslogtreecommitdiff
path: root/test_ffi/src
diff options
context:
space:
mode:
Diffstat (limited to 'test_ffi/src')
-rw-r--r--test_ffi/src/lib.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/test_ffi/src/lib.rs b/test_ffi/src/lib.rs
index 38275e547..b0206276a 100644
--- a/test_ffi/src/lib.rs
+++ b/test_ffi/src/lib.rs
@@ -3,6 +3,8 @@
use std::thread::sleep;
use std::time::Duration;
+static BUFFER: [u8; 8] = [1, 2, 3, 4, 5, 6, 7, 8];
+
#[no_mangle]
pub extern "C" fn print_something() {
println!("something");
@@ -29,6 +31,16 @@ pub extern "C" fn print_buffer2(
}
#[no_mangle]
+pub extern "C" fn return_buffer() -> *const u8 {
+ BUFFER.as_ptr()
+}
+
+#[no_mangle]
+pub extern "C" fn is_null_ptr(ptr: *const u8) -> u8 {
+ ptr.is_null() as u8
+}
+
+#[no_mangle]
pub extern "C" fn add_u32(a: u32, b: u32) -> u32 {
a + b
}