diff options
| author | Teddy Wing | 2018-08-26 08:34:44 +0200 | 
|---|---|---|
| committer | Teddy Wing | 2018-08-26 08:34:44 +0200 | 
| commit | 076af0f0145b7f924eb32be010311545d039850f (patch) | |
| tree | 40740fd0de1180a407bcea0137b0195defb4232a /includer.c | |
| parent | f09a074b3e96b960ee42dc484971e3fa192499d0 (diff) | |
| download | dome-key-map-076af0f0145b7f924eb32be010311545d039850f.tar.bz2 | |
Link library with a test C program
Make a test `includer.c` program that includes the Rust library and
calls our `c_run_key_action()` to see if it actually works. Currently it
doesn't, we get `(null)` printed to stdout.
Add a Makefile with the build command for the C program.
cbindgen.toml:
Remove `KeyActionResult` from exported types, as the `Option` field it
contains caused `gcc` to complain.
cocoa_bridge.rs:
* Comment out all 'cocoa' crate related code as the 'cocoa' code was
  interfering with GCC compilation as a result of my not linking to
  Cocoa frameworks.
* Add a new test map definition that corresponds with the one we look
  for in `includer.c`.
parser.rs:
Add `#[repr(C)]` to `MapKind` because it needs to be exported in the
library and generated into our C header file.
Diffstat (limited to 'includer.c')
| -rw-r--r-- | includer.c | 12 | 
1 files changed, 12 insertions, 0 deletions
| diff --git a/includer.c b/includer.c new file mode 100644 index 0000000..9a02d22 --- /dev/null +++ b/includer.c @@ -0,0 +1,12 @@ +#include <stdio.h> +#include "dome_key_map.h" + +#define SIZE 2 + +int main() { +	HeadphoneButton trigger[SIZE] = {Play, Down}; +	const CKeyActionResult *result = c_run_key_action(trigger, SIZE); +	printf("%s", result->action); + +	return 0; +} | 
