C ++的脚本语言 [英] Scripting language for C++

查看:180
本文介绍了C ++的脚本语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在脚本语言中有点生锈,只要他们最近像蘑菇一样弹出来)。

I'm getting a little rusty in scripting languages, provided they're popping like mushrooms lately :)

今天我认为,脚本语言与C ++无缝衔接,也就是说,可以使用C ++类,并且对我来说最重要的可以编译成C ++或一些DLL / .SO(加上它的.h),以便我可以链接到我的C +程序并使用脚本定义或实现的类。

Today I thought that it would be nice to have a scripting language that talks seamlessly to C++, that is, could use C++ classes, and, the most important for me, could be compiled into C++ or some DLL/.SO (plus its .h) so that I could link it into my C++ program and make use of the classes the script defines or implements.

我知道我可以嵌入任何流行的脚本语言,如lua,ruby,python ...但接口通常包括一些评估所提供的脚本代码的eval函数。根据用于耦合C ++和脚本语言的工具,脚本回调到C ++的集成可能或多或少容易写,但我还没有看到任何脚本语言实际上允许我写独立的模块,作为.h和.so / dll暴露给我的程序(也许沿着生成C ++代码的脚本语言的行)。

I know I could embed any popular scripting language such as lua, ruby, python... but the interface usually includes some kind of "eval" function that evaluates the provided scripting code. Depending on the tool used to couple C++ and the scripting language, the integration for callbacks of the script into C++ could be more or less easy to write, but I haven't seen any scripting language that actually allows me to write independent modules that are exposed as a .h and .so/dll to my program (maybe along the lines of a scripting language that generates C++ code).

你知道任何这样的工具/脚本语言?

Do you know any such tool/scripting language?

提前感谢。

PD。我一直在思考 Vala 或Haskell的GHC。它们生成C,但不是C ++ ...

PD. I've been thinking along the lines of Vala or Haskell's GHC. They generate C, but not C++...

推荐答案

以下是更多的C ++集成导向比语言绑定:

The following ones are more C++ integration oriented than language bindings :

  • ChaiScript - trying at the moment in a little project, interesting, this one is MADE with C++ in mind and works by just including a header! Not sure if it's good for a big project yet but will see, try it to have some taste!
  • Falcon - trying on a big project, excellent; it's not a "one include embed" as ChaiScript but it's because it's really flexible, and totally thought to be used in C++ (only C++ code in libs) - I've decided to stick with it for my biggest project that require a lot of scripting flexibility (comparable to ruby/python )
  • AngelScript - didn't try yet
  • GameMonkey - didn't try yet
  • Io - didn't try yet

对于你来说,如果你真的想用C ++编写你的脚本模块,并且很容易将它暴露给脚本语言,我会建议使用Falcon 。它完全是C ++中的MADE,所有的模块/库都是这样写的。

For you, if you really want to write your scripting module in C++ and easily expose it to the scripting language, I would recommand going with Falcon. It's totally MADE in C++, all the modules/libraries are written that way.

这篇关于C ++的脚本语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆