gpt4 book ai didi

c++ - FFI 的 Ruby 扩展

转载 作者:行者123 更新时间:2023-11-27 23:27:58 24 4
gpt4 key购买 nike

我有这样的,例如,带有类的 C++ 库:

class Hello2

bool doSomething()
end

end

class Hello

Hello2 getStatus()
{
Hello2* hello2 = new Hello2();
return hello2;
}

end

如何通过 ffi ( https://github.com/ffi/ffi ) 映射它?因为它不是静态方法。我在 ruby 中需要这样的东西:

obj1 = Hello.new
obj2 = obj1.get_status
obj2.do_something

谢谢。

最佳答案

以下是一些可能有用的链接:

这是 rb++ 的 github 存储库中示例的链接:

https://github.com/jameskilton/rbplusplus/tree/master/samples/my_math

关于c++ - FFI 的 Ruby 扩展,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7960101/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com