From 4fd3fd4ded73aa4ba5320de50cd6b19fdf70a8a7 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 25 Aug 2018 22:52:41 +0200 Subject: Generate a partial C header for our FFI API * Add the 'cbindgen' crate to help us auto-generate a C header for our exported FFI enums/structs/functions * Add a `build.rs` to generate the C header using cbindgen * Add a rough config for 'cbindgen' * Export everything from the `cocoa_bridge` crate to include the `KeyActionResult` struct * Commit the C header generated by 'cbindgen' Looks promising. We do, however, have some things to correct. We can't use `Option` in C, for instance, so we'll need to fix that in our `KeyActionResult`. Similarly, we need to rework the `run_key_action()` function to make it accessible as a C interface. Right now it returns an `Option`, which isn't going to work, and I'm not sure if the slice input translates. That (any maybe more) is why it doesn't get generated by 'cbindgen' into the header output file. --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index 3127631..db113dc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -8,4 +8,4 @@ mod parser; use parser::{HeadphoneButton, MapGroup, MapKind}; -pub use cocoa_bridge::run_key_action; +pub use cocoa_bridge::*; -- cgit v1.2.3