How to embed Ruby in C++?

后端 未结 5 1595
滥情空心
滥情空心 2020-12-09 03:43

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 in

5条回答
  •  时光说笑
    2020-12-09 04:20

    I've been working on Rarity (https://github.com/Plaristote/Rarity), which does two things:

    • Generates Ruby bindings from a YML description of your C++ API
    • Allows interaction with Ruby script in the most C++ fashion there is

    I've solved a good deal of question (exception handling, garbage collection)... I haven't seen anywhere else the code generation that Rarity uses to make your bindings come to life. I also haven't seen any other lib that allows such an easy conversion between C++ and Ruby types.

    I think Rarity's worth the shot ! And I'd be glad to have some feedback as well :) !

提交回复
热议问题