Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Embedding Google V8 into ANSI C Application - where to start?

I would like to embed a javascript engine into an ANSI C application.

In fact, I would like to be able to run some code entered on runtime, while being able to interact with some C variables and functions.

So, is V8 the only choice? Where should I start?

like image 750
Stasik Avatar asked Jun 30 '12 10:06

Stasik


1 Answers

There are some "embedding quickstart" pages:

V8 JS Engine (WebKit):

https://developers.google.com/v8/get_started

https://developers.google.com/v8/embed

SpiderMonkey JS Engine (Firefox):

https://developer.mozilla.org/en/How_to_embed_the_JavaScript_engine

LUA: http://heavycoder.com/tutorials/lua_embed.php http://www.ibm.com/developerworks/linux/library/l-embed-lua/

After quick looking into these links I think that V8 is more complex; both Lua and SM are easy to integrate into application. And to call C functions from SM or Lua you should write some wrapper code for every function.

like image 137
osgx Avatar answered Oct 21 '22 02:10

osgx