新手问题 请问在 Ruby 中怎么用 ffi Gem 接收一个数组或多个值

paulshu · 2017年10月15日 · 1251 次阅读

1. 请问,如果我要用 ffi 传一个数组进来,Go 语言写的,输出为数组类型

调用时就会报这样的错,无法正常读取

panic: runtime error: cgo result has Go pointer

goroutine 17 [running, locked to thread]:
main._cgoexpwrap_fd0f1cf0a105_GoAdd.func1(0xc420040e98)
    command-line-arguments/_obj/_cgo_gotypes.go:46 +0x6e
main._cgoexpwrap_fd0f1cf0a105_GoAdd(0x4028000000000000, 0x4041333333333333, 0xc4200a2020, 0x3, 0x4)
    command-line-arguments/_obj/_cgo_gotypes.go:48 +0x9d

2. 请问,如果我要用 ffi 同时传多个值进来呢?

我试了很多方法,每次只能收到第一个值。我估计我的方法不对,各位有类似应用的经验吗?

暂无回复。
需要 登录 后方可回复, 如果你还没有账号请 注册新账号