[Mono-list] Embedding Mono
Robert Jordan
robertj at gmx.net
Sat Jul 16 07:18:52 EDT 2011
On 16.07.2011 09:26, lodle wrote:
> 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<mono/jit/jit.h>
> #include<mono/metadata/assembly.h>
> #include<mono/metadata/mono-config.h>
>
> 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
mono_jit_exec expects the assembly name in argv[0]. If you didn't
run your test like this:
./test MonoEmbedLib.exe
then there will be no argv[0] left for mono_jit_exec.
Robert
More information about the Mono-list
mailing list