Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exit 1 when calling mono_jit_init

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

like image 549
JNQ Avatar asked Jun 09 '26 16:06

JNQ


1 Answers

Your application probably fails on loading Mono libraries.

You can use Process Monitor (https://learn.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.

like image 182
Marcin Zawiejski Avatar answered Jun 11 '26 06:06

Marcin Zawiejski