diff options
| author | Teddy Wing | 2018-08-26 13:30:09 +0200 |
|---|---|---|
| committer | Teddy Wing | 2018-08-26 13:37:16 +0200 |
| commit | 97a19adb5a2e53a86ba5505795f505117d2fa7b6 (patch) | |
| tree | 5951160da4819bc02b9c2c37734007eb94453eb9 /Makefile | |
| parent | 2a02c11a3a33e9f8f77dcdda17a963c1ef782bf3 (diff) | |
| download | dome-key-map-97a19adb5a2e53a86ba5505795f505117d2fa7b6.tar.bz2 | |
c_run_key_action(): Correctly send action string to C
Using `.as_ptr()` on the `CString` didn't work. The C code wouldn't
print anything.
Turns out I needed to use `.into_raw()` in order to:
> [Consume] the CString and [transfer] ownership of the string to a C
> caller.
(https://doc.rust-lang.org/std/ffi/struct.CString.html#method.into_raw)
This allows us to correctly access and print the string in our C code.
Note that we'll still need to free the string using a new Rust function
that should be callable from C, otherwise we'll end up with a memory
leak.
Diffstat (limited to 'Makefile')
0 files changed, 0 insertions, 0 deletions
