I've tried a few different ways now and assume I may be missing something obvious.
All I want to do is pass a Ruby string to Go:
// Go function
func receive(s string) string {
fmt.Println("Go String:", s)
return s
}
# ruby code
module PassStringToGo
extend FFI::Library
ffi_lib File.expand_path("./receive_string.so", File.dirname(__FILE__))
attach_function :receive, [:string], :string
end
str = "Ruby String"
PassStringToGo.receive(str)
The output in the Go function is blank.
Do I have to use a pointer?
Thanks,
-- Mike