From 2a02c11a3a33e9f8f77dcdda17a963c1ef782bf3 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sun, 26 Aug 2018 10:17:24 +0200 Subject: c_run_key_action(): Get the C code to actually print something out Ensure that the C code can really print something sent from the Rust code. Our action string wasn't getting printed out, so I wanted to see it working with a test string. Need to figure out what I have to do to get it to work for real now. --- src/cocoa_bridge.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/cocoa_bridge.rs b/src/cocoa_bridge.rs index 1f0b693..f33a739 100644 --- a/src/cocoa_bridge.rs +++ b/src/cocoa_bridge.rs @@ -1,4 +1,4 @@ -use std::ffi::CString; +use std::ffi::{CStr, CString}; use std::ptr; use std::slice; @@ -69,7 +69,7 @@ pub extern "C" fn c_run_key_action( match k.action { Some(a) => { CKeyActionResult { - action: a.as_ptr(), + action: CStr::from_bytes_with_nul(b"test?\n\0").unwrap().as_ptr(), kind: &k.kind, } }, -- cgit v1.2.3