[Mono-dev] Embedding Mono.

Massimiliano Mantione massi at ximian.com
Tue Aug 5 02:41:32 EDT 2008


On Tue, 2008-08-05 at 04:17 +0200, BaSS wrote:
> When using mono.dll for scripting/embedding purposes, the only way to
> get “scrip code” into the compiler is to use a “native” .net assembly
> and move the script code into the managed world first?

AFAIK, yes.
The rationale is that Mono provides a .NET runtime, and a plain .NET
runtime does not contain a compiler-interpreter for an arbitrary
scripting language... it just allows you to execute managed code from
existing assemblies.

> Or is there some obvious exported method somewhere in the dll where I
> can directly inject “(script) code to be executed” into the JIT (and
> execute it)?

If you provide a managed DLL containing your interpreter-compiler, you
can invoke its methods from unmanaged code using the embedding API.
This would be a "single invocation that executes a script".

Otherwise you could try to use a methodbuilder from unmanaged code, but
I don't know if it can work and I doubt it would be worth the effort...

My 2c,
  Massi




More information about the Mono-devel-list mailing list