[Mono-list] Assembly.GetExecutingAssembly() not working in embedded mono?
nelson
nelson.cabral at gmail.com
Sat Feb 16 22:41:17 UTC 2013
I'm trying to embed mono in a c++ executable, and mono crashes on
Assembly.GetExecutingAssembly. Any idea of what I missed ?
EmbeddedMonoTest.cpp :
// EmbeddedMonoTest.cpp : Defines the entry point for the console
application.
//
#include "stdafx.h"
#include <mono/metadata/debug-helpers.h>
#include <mono/metadata/exception.h>
#include <mono/jit/jit.h>
#include <mono/metadata/assembly.h>
int _tmain(int argc, _TCHAR* argv[])
{
MonoDomain* domain = mono_jit_init_version ("ClassLibrary1",
"v4.0.30319");
MonoAssembly* _assembly_fbmonoengine = mono_domain_assembly_open
(domain, "ClassLibrary1.dll");
MonoImage* _image_fbmonoengine = mono_assembly_get_image
(_assembly_fbmonoengine);
MonoClass* klass = mono_class_from_name(_image_fbmonoengine,
"ClassLibrary1", "Class1");
MonoMethod* test = mono_class_get_method_from_name(klass, "Test" ,
0);
mono_runtime_invoke(test, NULL, NULL, NULL);
return 0;
}
Class1.cs :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
namespace ClassLibrary1
{
public class Class1
{
public static void Test()
{
Assembly.GetExecutingAssembly();
}
}
}
The error :
Unhandled exception at 0x65ad2148 in EmbeddedMonoTest.exe: 0xC0000005:
Access violation reading location 0x`00000008.
--
View this message in context: http://mono.1490590.n4.nabble.com/Assembly-GetExecutingAssembly-not-working-in-embedded-mono-tp4658613.html
Sent from the Mono - General mailing list archive at Nabble.com.
More information about the Mono-list
mailing list