如何嵌入的Node.js间preTER到C / C ++? [英] How to embed Node.js interpreter into C/C++?
问题描述
我想在我的C / C ++应用程序使用Node.js的脚本。有人建议我开始与V8,libev和libeio;但它意味着从头开始重写Node.js的。
I want to use Node.js scripts in my C/C++ applications. Some people suggested me to start with v8, libev and libeio; but it means rewriting Node.js from scratch.
那么,是不是可以将Node.js的嵌入C或C ++?
So, is it possible to embed Node.js into C or C++?
推荐答案
这可能是,V8是用C ++,Node.js的可以在V8上运行,但除非你有一个的非常的很好的理由你为什么会贯穿C ++,你可能服务要好得多找到一个合适的C ++库,并直接用C实现所需的功能++的JavaScript。集成脚本语言和本地code的任务通常是不平凡的。例如。 V8文档。提供的Qt C ++和JavaScript之间的pretty体面的整合,它仍然不平凡的脚本和code之间来回移动对象。
It probably is, V8 is written in C++, node.js can run on V8, but unless you have an extremely good reason why you would run javascript through C++ you are probably much better served finding an appropriate C++ library and implementing the needed functionality directly in C++. The task of integrating scripting languages and native code is usually not trivial. E.g. V8 documentation. Qt offers a pretty decent integration between c++ and javascript and it still not trivial to move objects back and forth between script and code.
这篇关于如何嵌入的Node.js间preTER到C / C ++?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!