Exit 1 when calling mono_jit_init

Viewed 474

Hi, I try to embed mono in a c++ application on windows. I followed http://www.mono-project.com/docs/compiling-mono/windows/ and I have my headers, lib and dll built for win64. I wrote a simple app that just calls

MonoDomain *domain;
domain = mono_jit_init("ConsoleApplication1.exe");

Everything builds and link find but when I run my program, I can break and step until the mono_jit_init call. Then the apps performs an exit1 and I can't see what's wrong.

I tried both release and debug.

Any ideas on how to find the issue? Properly embed mono? Thanks, JNQ

1 Answers

Your application probably fails on loading Mono libraries.

You can use Process Monitor (https://docs.microsoft.com/en-us/sysinternals/downloads/procmon) to find out what exactly fails for you:

  • Run Process Monitor
  • Set Process Monitor filter to "[Process Name] [is] [Your process name, e.g. ConsoleApplication1.exe] then [Include]"
  • Run you program and lookup for "CreateFile" operations with "NAME NOT FOUND" Result and see Path column to find out what file is missing

In my case it was a failure on loading mono mscorlib.dll from lib\mono\4.5\mscorlib.dll so copying the files from the Mono installation to the path pointed by Process Monitor has helped.

Related