[Mono-dev] Compiling Mono Runtime in VS2010

Robert Jordan robertj at gmx.net
Mon Jun 28 04:28:18 EDT 2010

On 28.06.2010 02:27, Guy Sherman wrote:
> I managed to compile a 64-bit version of the mono runtime, using Visual
> Studio 2008, and I am having a great time working out how to embed mono.
> However, I am using Visual Studio 2010 for my solution, and whenever I call
> free on a pointer allocated by the runtime (like a MonoClass*), I get a
> failed debug assertion which has something to do with heap corruption, and
> something to do with code within the same process being from different
> versions of the C runtime (2008 vs 2010 I guess).

You're not supposed to free any pointers returned by
the embedded APIs, unless it's documented as a requirement.

> As an aside, when trying to call g_free, I get an unresolved externals
> error despite the fact that the path to glib-2.0.lib is definitely in my
> project settings. Could this be because the glib libs that ship with mono
> for windows a 32-bit, and I'm trying to compile 64-bit?

The VC build is using EGLib (embedded GLib) by default,
especially for 64-bit for which no GLib exists.

If and only if you are supposed to free pointers returned by the
embedded APIs (look at the docs), then mono_free() must be used
in place of g_free() or free().


More information about the Mono-devel-list mailing list