From 9b0e6e4207f5c44bef5d0b28ba036040845f82d8 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sun, 26 Aug 2018 01:32:43 +0200 Subject: Get `run_key_action` to export correctly to C Add a new wrapper function for `run_key_action` that uses C appropriate inputs & outputs and calls into our Rusty `run_key_action`. This new function now correctly gets a header generated for it by 'cbindgen'. Immense thanks to Jake Goulding on the Rust FFI Omnibus for showing me how to pass a slice argument from C: http://jakegoulding.com/rust-ffi-omnibus/slice_arguments/ In order to pass the slice from C, we need to pass a C array and its length to the function. Cool. --- dome_key_map.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'dome_key_map.h') diff --git a/dome_key_map.h b/dome_key_map.h index 473d2f0..d128979 100644 --- a/dome_key_map.h +++ b/dome_key_map.h @@ -20,3 +20,5 @@ typedef struct { Option_CString action; MapKind kind; } KeyActionResult; + +const KeyActionResult *c_run_key_action(const HeadphoneButton *trigger, size_t length); -- cgit v1.2.3