3

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 ?)

Ghassen Hamrouni
  • 3,138
  • 2
  • 20
  • 31
  • 3
    Mono is not a script engine by a long shot. It needs the code compiled to bytecode and the compiler library is not that small. Also if you are going to use it on windows, you can use .NET runtime instead of Mono as it's usually already available and they are the same thing. – Jan Hudec Mar 03 '11 at 11:41
  • 1
    Building Mono under Windows is not an easy task. The Solution files don't appear to of been updated in a while. There are pre-compiled version of mono though for Windows. – Andrew T Finnell Mar 05 '11 at 14:50
  • 1
    As for people saying Mono is not a scripting engine, we should define the term scripting int he context of what is needed in the project. Unity and Torque both provide Mono support to drive their game engines. – Andrew T Finnell Mar 05 '11 at 14:52

5 Answers5

7

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

yasouser
  • 5,113
  • 2
  • 27
  • 41
  • I'm up voting this as I think Lua can be used to solve many solutions. – Andrew T Finnell Mar 05 '11 at 14:51
  • Lua can solve many solutions, but you should at least mention LuaBind (http://www.rasterbar.com/products/luabind.html) since the question involves "C++" and "ease of integration." Without the help of SWIG, plain Lua would take a lot of work with C++. – lefticus Mar 07 '11 at 06:58
  • or if you do not use BOOST, [LuaBridge](https://github.com/vinniefalco/LuaBridge) is a good alternative – Dmitry Ledentsov Mar 28 '13 at 16:43
4

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.

lefticus
  • 3,346
  • 2
  • 24
  • 28
  • Are you sure that, for example, Second Life is using scripting wrong (they're using Mono to accelerate LSL)? – SK-logic Mar 07 '11 at 13:46
3

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.

David Given
  • 13,277
  • 9
  • 76
  • 123
  • 7
    Where do these 'Language X can be faster than C' statements come from? I've always wondered. – Collin Dauphinee Mar 03 '11 at 12:43
  • Benchmarks? Go ask on the mailing list; there's a number of people doing precisely this, including some people who are actually using C for high level work and then calling into Lua for the perfomance-critical bits... – David Given Jan 04 '12 at 17:46
2

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.

SK-logic
  • 9,605
  • 1
  • 23
  • 35
0

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

MSalters
  • 173,980
  • 10
  • 155
  • 350