[Mono-list] Embedding mono

Jonathan Pryor jonpryor@vt.edu
Fri, 18 Jun 2004 07:40:31 -0400


On Fri, 2004-06-18 at 05:08, Joe Ante wrote:
> Our script files are currently not stored as individiual text files instead
> they are serialized in one big file. Is it possible to pass mono a c string
> for compiling instead of a file?

It's mcs which does the compiling, and mcs reads from files.  So No, you
can't store the scripts as a C-string within your program.

Is the user able to add their own scripts?  If not, you could just
pre-compile the scripts into assemblies (.DLLs) and bundle the
assemblies with your program, saving the overhead of compiling them at
runtime...

If the user can add their own scripts, you could store them as strings
within a large file, but you'd have to write them to a temp file for mcs
to compile.  You could then dynamically load the new assemblies at
runtime.

> With python we loaded scripts from the disk only on demand.
> Is it possible to do the same in mono?

It should be possible to load assemblies on demand.

> Our game engine is currently not built as a dll. Is it possible make mono
> call C functions directly in the executable or do we have to compile the
> engine into dll?

You can add internal calls to the runtime, so it isn't necessary to
package your engine up as a DLL.  Instead, your engine would be
responsible for initializing mono and loading/executing any required
assemblies (user scripts, etc.).

See: http://www.go-mono.com/embedded-api.html

 - Jon