I'm trying to call a function which accepts a string, written in Rust.
The Rust code is then compiled to C and included in my Ruby code via the FFI gem.
When I call the Rust function and pass a string I get nothing.
Rust code:
#[no_mangle]
pub extern fn speak(words: &str) {
println!("{}", words);
}
Ruby code:
require 'ffi'
module Human
extend FFI::Library
ffi_lib '../target/release/libruby_and.dylib'
attach_function :speak, [:string], :void
end
Human.speak("Hello, we are passing in an argument to our C function!!")