Hi, does anybody know how to call C++ functions or methods via JavaScript. Need scripting like Lua/Python-C++ but with JavaScript.
Thanks in advance.
Hi, does anybody know how to call C++ functions or methods via JavaScript. Need scripting like Lua/Python-C++ but with JavaScript.
Thanks in advance.
Javascript instructions are interpreted by the browser, and I don't think there is a C++ layer for JS (not that it would make much sense anyway). What are you trying to achieve?
Mozilla's Spidermonkey:
https://developer.mozilla.org/en/JavaScript%5FC%5FEngine%5FEmbedder%27s%5FGuide
What about calling a server-side script via a Javascript XHR, that executes your C-program on system level?
There are several different JavaScript engines you could use. I don't think they have a common programming interface so you'd have to pick one and work with it. Google Chrome uses V8 and Mozilla uses spidermonkey. Both V8 and spidermonkey are open source. I'd guess that spidermonkey is more mature since it's been around for a while. There is also WebKit JavaScript engine from Apple, also open source.
Wikipedia also has a list of JavaScript engines.
Thanks guys for answers! Seems easy way will be using Lua for scripting.