Search code examples
c++monoembedmono-embedding

Embed Mono: cannot find mono-2.0.dll


I'm on windows 8.1 using VS2012.

I am trying to follow http://www.mono-project.com/docs/advanced/embedding/ to embed the Mono CLR into a C project. After some issue, I have it compiling now. I used the .def file in the article: http://github.com/mono/mono/blob/master/msvc/mono.def Note that this file says: LIBRARY mono-2.0.dll

When I run it, I get an error that the mono-2.0.dll can not be located.

I have mono-3.2.3 installed and I don't see a mono-2.0.dll anywhere.

  1. What mono .dll implements the mono_xxx API (like mono_jit_init)?
  2. Do I need to set env-vars to have the mono folder known to the OS?

I am kind of worried that the document states that mono-2.0 is for older versions and 'mono' should be used - but mono.dll also does not exist...


Solution

  • See this answer: Getting/compiling Mono-2.0.dll for embedding

    The libraries that you are looking for may be found in the bin directory of the mono installation folder. Actually, after installing mono 3.2.3 there are two libraries in the MONO_INSTALLATION_PATH\bin\ directory: libmonoboehm-2.0.dll and libmonosgen-2.0.dll (you must choose either Boehm or SGen GC implementation)

    (Links for Boehm and SGen now redirect to the same web page)

    I have never used embedded Mono in Windows (I always use Linux) but perhaps changing in your .def file to those library names your program will work.

    For example, for Boehm you must download mono.def and edit it like this:

    ; file generated by create-windef.pl
    LIBRARY libmonoboehm-2.0.dll
    EXPORTS
    

    For SGen, just download monosgen.def and edit it in this way:

    ; file generated by create-windef.pl
    LIBRARY libmonosgen-2.0.dll
    EXPORTS