[Mono-list] Help with using Visual Studio 2k5 to embed mono

enkuklios jason.ae86 at gmail.com
Sun Jan 11 19:21:44 EST 2009


Hi,

(edited to re-send to the mailing list...just made my account)

I have successfully produced the mono.lib (using the installed version of
mono), and compiled my test application against it using visual studio 2005,
however when I attempt to run my test I get an unhandled exception when
calling mono_jit_exec().

Here is my source code.

One C# exe project with a single .cs file containing:

using System;
using System.Collections.Generic;
using System.Text;

namespace ManagedConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("From C#!");
        }
    }
}

One C++ exe project with a single .cpp file containing:

#include <iostream>

#include <mono/jit/jit.h>
#include <mono/metadata/object.h>
#include <mono/metadata/environment.h>
#include <mono/metadata/assembly.h>
#include <mono/metadata/debug-helpers.h>
#include <mono/metadata/mono-config.h>

void main(int argc, char* argv[])
{
	mono_set_dirs("C:\\Program Files\\Mono-2.0.1\\lib\\", "C:\\Program
Files\\Mono-2.0.1\\etc");

	mono_config_parse(NULL);

	MonoDomain *domain;

	domain = mono_jit_init("ManagedConsoleApp.exe");

	MonoAssembly *assembly;

	assembly = mono_domain_assembly_open(domain, "ManagedConsoleApp.exe");
	if (assembly)
	{
		int retval = mono_jit_exec(domain, assembly, argc - 1, argv + 1);
	}

	mono_jit_cleanup(domain);
}


Here is the debug spew when running UmanagedLauncher.exe using the
MONO_LOG_LEVEL environment variable:

Mono-INFO: Config attempting to parse: 'C:\Program
Files\Mono-2.0.1\etc\mono\config'.
Mono-INFO: Assembly Loader probing location: 'C:\Program
Files\Mono-2.0.1\mscorlib.dll'.
Mono-INFO: Assembly Loader probing location: 'C:\Program
Files\Mono-2.0.1\mono\2.0\mscorlib.dll'.
Mono-INFO: Assembly Loader probing location: 'C:\Program
Files\Mono-2.0.1\lib\mono\2.0\mscorlib.dll'.
Mono-INFO: Image addref mscorlib 00358C70 -> C:\Program
Files\Mono-2.0.1\lib\mono\2.0\mscorlib.dll 00358030: 2

Mono-INFO: AOT failed to load AOT module C:\Program
Files\Mono-2.0.1\lib\mono\2.0\mscorlib.dll.dll: The system cannot find the
file specified.



Mono-INFO: Assembly Loader loaded assembly from location: 'C:\Program
Files\Mono-2.0.1\lib\mono\2.0\mscorlib.dll'.
Mono-INFO: Config attempting to parse: 'C:\Program
Files\Mono-2.0.1\lib\mono\2.0\mscorlib.dll.config'.
Mono-INFO: Config attempting to parse: 'C:\Program
Files\Mono-2.0.1\etc\mono\assemblies\mscorlib\mscorlib.config'.
Mono-INFO: Assembly mscorlib 00358C70 added to domain ManagedConsoleApp.exe,
ref_count=1

Mono-INFO: Assembly Loader probing location: 'ManagedConsoleApp.exe'.
Mono-INFO: Image addref ManagedConsoleApp 00357C20 ->
E:\projects\IstariaLauncher\bin\debug\ManagedConsoleApp.exe 00A30D30: 3

Mono-INFO: Assembly ManagedConsoleApp 00357C20 added to domain
ManagedConsoleApp.exe, ref_count=1

Mono-INFO: AOT failed to load AOT module
E:\projects\IstariaLauncher\bin\debug\ManagedConsoleApp.exe.dll: The system
cannot find the file specified.



Mono-INFO: Assembly Loader loaded assembly from location:
'ManagedConsoleApp.exe'.
Mono-INFO: Config attempting to parse:
'E:\projects\IstariaLauncher\bin\debug\ManagedConsoleApp.exe.config'.
Mono-INFO: Config attempting to parse: 'C:\Program
Files\Mono-2.0.1\etc\mono\assemblies\ManagedConsoleApp\ManagedConsoleApp.config'.
Mono-INFO: Assembly Ref addref ManagedConsoleApp 00357C20 -> mscorlib
00358C70: 2





Thank you in advance for any help.
-- 
View this message in context: http://www.nabble.com/Help-with-using-Visual-Studio-2k5-to-embed-mono-tp21405124p21405124.html
Sent from the Mono - General mailing list archive at Nabble.com.



More information about the Mono-list mailing list