How to embed Ruby in C++?(如何在 C++ 中嵌入 Ruby?)
问题描述
在 C++ 中嵌入 Ruby 作为脚本语言的最佳方法是什么?使用 ruby.h?挥舞?还有什么?我需要的是向 Ruby 公开一些 C++ 对象,并让 Ruby 解释器评估访问这些对象的脚本.我不在乎扩展 Ruby 或在 C++ 中访问它.
What's the best way to embed Ruby as a scripting language in C++? Using ruby.h? SWIG? Something else? What I need is to expose some C++ objects to Ruby and have the Ruby interpreter evaluate scripts that access these objects. I don't care about extending Ruby or accessing it in C++.
我发现了这篇关于在 C++ 中嵌入 Ruby 的文章,虽然它非常有用,它有点旧,我想知道是否有关于该主题的任何其他资源(或类似引擎的开源实现).
I've found this article on embedding Ruby in C++, and while it's very useful, it's kinda old and I was wondering if there are any other resources on the subject (or open source implementations of similar engines).
推荐答案
swig 可能是要走的路..... 但是 ruby 嵌入得不太好......
swig is probablly the way to go..... but ruby doesnt embed too well......
如果你想要一种很好地嵌入 C++ 的语言,试试 lua
if you want a language that embeds nicely into C++, try lua
这篇关于如何在 C++ 中嵌入 Ruby?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在 C++ 中嵌入 Ruby?
基础教程推荐
- 如何部分禁用 cmake C/C++ 自定义编译器检查 2021-01-01
- c++ STL设置差异 2022-01-01
- 随机插入/删除的综合向量与链表基准 2022-01-01
- 如何在 C++ 中正确使用命名空间? 2022-01-01
- 为什么我们不能使用“虚拟继承"?在 COM 中? 2022-01-01
- 如何更改 SysDateTimePick32 或 CDateTimeCtrl 的背景颜色? 2022-01-01
- C++:获取传递给函数的多维数组的行大小 2021-01-01
- 提升 ASIO 流缓冲 2021-01-01
- 将不可复制的闭包对象传递给 std::function 参数 2021-01-01
- 与 CAS 的原子交换(使用 gcc 同步内置函数) 2022-01-01
