Search code examples
javascriptswigjvm-languages

SWIG and Javascript: does embedding the JVM/Rhino into my C++ app is still the only solution?


I really like the idea of automatic binding generation like SWIG does. But it is still lacking Javascript binding. I read that it could not be done with Spidermonkey because of the JS Context that must be passed as parameter to each function.

The only solution I found is to embed a JVM into my C++ application, generating bindings to Java using SWIG, and then using Rhino engine as the JS interpreter. It works fine, but it is really heavyweight!

Any other ideas?

Note: yes I know, I could use Python or Lua instead. But my question is really about JS.


Solution

  • Well, since I don't have any answers, I think that I must use other alternatives than SWIG.

    I found that page on the mozilla developer center mentioning several projects for wrapping JS with the Spidermonkey engine: Spiderape, Flusspferd, TriXUL and jsapigen.

    For V8, there is a similar project called v8-juice from the creator of Spiderape.