ClearScript on Mono/Xamarin?

Jul 11, 2014 at 3:15 AM
I was hoping to use ClearScript for adding JavaScript to a game written with MonoGame. Is there any chance that you could release a portable version which includes the V8 engine?

What are the challenges involved? It looks like it would be a significant undertaking, and perhaps there's better hope for an IL-only JS engine (maybe Jurassic would be easier).

ClearScript is fantastic, by the way :)
Jul 11, 2014 at 3:43 PM
Hello reubenbond!

Unfortunately Mono doesn't support mixed-mode assemblies such as ClearScript's V8 interface (ClearScriptV8-*.dll). We'd like to redesign that layer eventually, but that effort is not currently planned. ClearScript also depends heavily on the C# Runtime Binder, an API that Mono doesn't seem to support.

Have a look at Jurassic, Jint, and V8.NET. And thank you for your kind words!
Jul 14, 2014 at 1:34 PM
Hi, I'm also looking to use this cross platform and have been looking at alternatives for a while, but so far Clearscript is the only one that does things the way I want it to. It was a real bummer when I noticed it only worked on Windows.

How does V8.NET do it, since their library works on other platforms? What are they doing different?

I was going to compare to see if I could make the clearscript v8 work with's implementation, but my lack of c++ knowledge would be like climbing a mountain for me.

I really hope that you'll make it work cross platform soon!
Jul 14, 2014 at 4:40 PM
Hi Cadavre,

How does V8.NET do it, since their library works on other platforms? What are they doing different?

The difference has to do with the way these projects interface managed code with native code. Our understanding is that V8.NET uses P/Invoke with the managed and native sides residing in separate assemblies, whereas ClearScript uses mixed-mode assemblies that house both managed and native code.

Mono doesn't support mixed-mode assemblies on non-Windows platforms, and unfortunately this isn't just a matter of binary packaging. It affects how the marshaling code is written, and this is why creating a Mono-friendly version of ClearScript is not a trivial task.

Another issue for ClearScript is its reliance on the C# Runtime Binder, an API that Mono doesn't seem to support, although it does have other APIs that might provide a suitable alternative.

Jul 15, 2014 at 3:57 PM
Thanks for the quick response! I hope you will eventually make it work cross platform, ClearScript is really good!
Jul 16, 2014 at 11:23 PM
By the way, I stumbled upon this thing called swig ( while looking into using RakNet.
Quote from the RakNet documentation:
What is Swig?

Swig is an application that generates wrapper code for a native DLL to interface with other languages allowing you to use a C/C++ library in one of the supported languages. Currently Swig configuration for RakNet is set up to generate a managed interface that can be used in managed C# in Windows, as well as in Linux with Mono.

Swig generates a CXX and .h file, which exposes interfaces that can be used by the target language. The CXX file is included when building the C++ dll that the target language uses.

Swig also generates files in the target language for inclusion in the project of the target language to interface with the dll. These are added to the project of the target language.
Could this be of any use?
Jul 17, 2014 at 2:15 PM
Thanks Cadavre! We'll take a look, but the issue isn't interop as much as it is the redesign and re-implementation of the ClearScriptV8 layer.
Jul 17, 2014 at 2:50 PM
Yeah, okay, but it might still be useful! :)
Dec 27, 2014 at 9:34 PM
Just signing in to register my interest in running under Mono also.

considering Microsoft is making vNext cross platform I think having this EXCELLENT project cross platform would be awesome. I know, I know, easier said than done but from my user perspective talk is cheap :)