How to embed Node.js interpreter into C/C++?

后端 未结 6 1470
后悔当初
后悔当初 2020-12-05 22:43

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.

So,

6条回答
  •  青春惊慌失措
    2020-12-05 23:34

    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.

提交回复
热议问题