c99v8embedded-languageembedded-v8

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?


Solution

  • 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.