[Mono-list] Embedding Mono

lodle admin at lodle.net
Sat Jul 16 03:26:25 EDT 2011


Hey Guys,

Trying to embed mono and have it all compiling but crashes when i try to run
a simple program. Have tried both 2.10.2 and 2.7.6 and it still crashes. 

First-chance exception at 0x65b131d2 in MonoEmbed.exe: 0xC0000005: Access
violation writing location 0x00000000.
Unhandled exception at 0x65b131d2 in MonoEmbed.exe: 0xC0000005: Access
violation writing location 0x00000000.


It out puts this warnings when running:
gmisc-win32.c:99: assertion 'filename != NULL' failed
gpath.c:108: assertion 'filename != NULL' failed


Here is the native client:

#include <stdio.h>
#include &lt;mono/jit/jit.h&gt;
#include &lt;mono/metadata/assembly.h&gt;
#include &lt;mono/metadata/mono-config.h&gt;

MonoDomain *g_pMonoDomain;
MonoAssembly *g_pMonoAssembly;

int main(int argc, char** argv)
{
	const char* file = "MonoEmbedLib.exe";
	mono_config_parse(NULL);
	mono_set_dirs("C:\\Mono-2.10.2\\lib", "C:\\Mono-2.10.2\\etc");

	g_pMonoDomain = mono_jit_init(file);
	g_pMonoAssembly = mono_domain_assembly_open(g_pMonoDomain, file);

	mono_jit_exec(g_pMonoDomain, g_pMonoAssembly, argc - 1, argv + 1); <<<
Crashes here
}


And the c# exe:
using System;

namespace MonoEmbedLib
{
    public class Class1
    {
        public static void Main()
        {
            Console.WriteLine("Hey Whats your name?");
            string name = Console.ReadLine();
            Console.WriteLine("Sup " + name + "? Hello world!");
        }
    }
}


Any ideas to what is causing it to crash?




--
View this message in context: http://mono.1490590.n4.nabble.com/Embedding-Mono-tp3671515p3671515.html
Sent from the Mono - General mailing list archive at Nabble.com.


More information about the Mono-list mailing list