Reputation: 3553
I have a JavaScript class, that I don't want to port to C++ as it is too huge and complicated. Is Is there any way in which I could call JavaScript functions from inside my C++ code.
Upvotes: 0
Views: 1528
Reputation: 6623
You could embed a JavaScript engine, such as V8. It's a pretty (very) big overhead though. Unless you have a specific need, it would probably be better to just port your code.
Upvotes: 2
Reputation: 17346
Unless you have a very specific requirement that forces you to do this, this would be a very bad idea. It'll have a terrible overhead (in terms of execution speed and memory usage). You should seriously consider porting your Javascript code to C++.
Upvotes: 1
Reputation: 5579
I suggest you to check out Google's V8 a C++ Javascript Engine used in Chrome http://code.google.com/p/v8/
Upvotes: 2