[Mono-list] Building / Embedding Mono on Win32

Rodrigo B. de Oliveira rodrigobamboo at gmail.com
Wed Jul 13 00:00:23 EDT 2005


On 7/12/05, Bruce Wilkie <bruce at bwilkie.com> wrote:
> Hello all.
> ...
> We're using VS.NET2003, and would like to keep using
> it - all our primary development would be on WinXP.

Using LoadLibrary/GetProcAddress works for me:

#include "stdafx.h"
#include <mono/jit/jit.h>

typedef MonoDomain* (*mono_jit_init_fn)(const char*);
typedef void (*mono_jit_cleanup_fn)(MonoDomain*);

int _tmain(int argc, _TCHAR* argv[])
    MonoDomain *domain;

    HMODULE mono = ::LoadLibrary(_T("mono-1.dll"));
    mono_jit_init_fn fn = (mono_jit_init_fn)::GetProcAddress(mono,

    domain = fn("main");

    mono_jit_cleanup_fn cleanup =
(mono_jit_cleanup_fn)::GetProcAddress(mono, "mono_jit_cleanup");

    return 0;

The only caveat is that mono-1.dll expects the system assemblies to be
located in a directory ../lib/mono/1.0 relative to the program
executable. Is this how it's supposed to work?


More information about the Mono-list mailing list