[英]Use Node.js as an interpreter
I would like to embed NodeJS in my application. 我想在我的应用程序中嵌入NodeJS。 The reason i would like to use NodeJS and not just the V8 directly, is because of the extensions that exist for NodeJS.
我之所以要使用NodeJS而不是直接使用V8的原因是因为存在NodeJS的扩展。 To do that i understand that i need to compile NodeJS with GYP.
为此,我了解我需要使用GYP编译NodeJS。 Got it.
得到它了。 But how do i work with it?
但是我如何使用它呢? is there a static lib to link to?
是否有链接的静态库? how to start it up?
如何启动? say i want to provide it with a V8 context, how do i pass it?
说我想为它提供V8上下文,如何传递它?
a bit at a loss here. 这里有点茫然。 hope for help.
希望有所帮助。
Note - i want to activate nodejs from my C++ code, not the other way around. 注-我想从我的C ++代码中激活nodejs,而不是相反。 i understand extensions, this is not what i want.
我了解扩展程序,这不是我想要的。
Regards, Gal. 问候,加尔。
As I got from this question the problem of immediate linking with node.js is still unsolved. 正如我从这个问题中得到的那样,与node.js的立即链接的问题仍然没有解决。 Actually the workaround may be running it in a separated process like an ordinary command line application.
实际上,变通办法可能是在一个单独的进程中(如普通命令行应用程序)运行它。 You may save your script to file, pass it as cmdline argument, then obtain std output from the node.js executable.
您可以将脚本保存到文件,将其作为cmdline参数传递,然后从node.js可执行文件获取std输出。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.