Embedding Mono vs Google V8?

4k views Asked by At

We want to add scripting to a project.

We are hesitating which script engine to use. I have used in the past V8 and it's quite impressive. I have used Mono as well but in toy-projects or prototypes only.

The constraints are :

  1. speed of execution.
  2. easy integration.
  3. must work on windows.
  4. 64-bit support.
  5. compiles under Visual Studio.

Which engine fits the best ?

(Are there any tutorial for compiling Mono under win64 with Visual Studio? Is there some packages that include Lib files and DLLs ?)

5

There are 5 answers

2
SK-logic On BEST ANSWER

There is an MSVS solution file included into Mono distribution, it is enough for building a library (but you won't be able to build .DLLs, better pick them from a binary distribution). See mkbundle for a way to embed .NET DLLs into a single binary. As for scripting itself, you can either embed Mono C# compiler (it is not that big, and it is easy to integrate) or use any of the numerous scripting languages that target .NET - e.g., IronPython.

2
David Given On

V8. It actually is a scripting engine rather than a full programming environment like Mono (which rivals Java for size).

However... if you want a scripting language, you might also want to have a look at Lua. It's famously easy to embed, really fast, really small, pretty easy to program for, and has a very liberal license. If speed's important there's LuaJIT, which is still under development but with care will handily beat C for numerical programming.

0
MSalters On

Python isn't bad either, with Boost.Python.

1
lefticus On

Since there are no upvoted answers, I'm going to mention ChaiScript (Yes, I'm a co-creator of the project). It's a header only scripting engine designed solely for embedding in C++ applications. It has full 64bit support and works with MSVC, G++ and MinGW. The only external dependency is boost.

Where it does not win is speed. If you need to do a lot of calculation in the script itself, well, I argue that you are using scripting wrong. The higher level the function you can expose to the scripting engine, the better.

3
yasouser On

I would suggest you to take a look at Lua. I think it fits your needs quite satisfactorily.