-
-
Save tqk2811/be176358c9d227c173137be155d79bff to your computer and use it in GitHub Desktop.
Trying mono in C++
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
public class HelloWorld | |
{ | |
static public void Main() | |
{ | |
Console.WriteLine("Hello Mono World"); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <mono/jit/jit.h> | |
#include <mono/metadata/assembly.h> | |
#pragma comment(lib, "mono-2.0.lib") | |
int main(int argc, char* argv[]) | |
{ | |
mono_set_dirs("C:\\Program Files (x86)\\Mono\\lib", | |
"C:\\Program Files (x86)\\Mono\\etc"); | |
MonoDomain *domain; | |
domain = mono_jit_init("HelloWorld"); | |
MonoAssembly *assembly; | |
char* assemblyPath = "D:\\Mono\\hello.exe"; | |
assembly = mono_domain_assembly_open(domain, assemblyPath); | |
if (!assembly) | |
return 1; | |
int returnValue = mono_jit_exec(domain, assembly, argc, argv); | |
mono_jit_cleanup(domain);//crash here | |
return returnValue; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment