[Mono-dev] using coreclr in mono embedding sample project

Kornél Pál kornelpal at gmail.com
Mon Jun 15 11:07:01 EDT 2009


I don't know how Silverlight works on Windows but it should be checked 

There are two possible solutions:

1) Load assemblies as byte arrays rather than mapping them using 
LoadLibrary when core clr is enabled.

2) Modify the verifier or other code that assumes on-disk layout to be 
able to work with mapped sections as well.

I would prefer to do what Silverlight does.


Lucas Meijer wrote:
> Hey,
> In order to figure out how to properly use the new coreclr 
> functionality, verifiers etc, I've taken the
> test-metadata.c  sample that shows how to simply embed mono,  and I'm 
> adding some coreclr stuff to it.
> The sample works and runs fine with core clr disabled.
> If I add:
> mono_security_enable_core_clr ();
> before mono_jit_init(),  the mscorlib fails to load. When stepping 
> trough the program with a debugger,
> the point where these two (with coreclr and without) diverge,  is that 
> line 465 of coree.c:
> ModuleHandle = LoadLibrary(FileName);
> returns a valid handle when coreclr is turned off, and it returns 0 when 
> coreclr is turned on.
> This is on windows, with r135921 runtime+corlib, using msvc2008 built 
> mono using the stock msvc projectfile.
> I'm a bit surprised by this actually, as I wouldn't expect a call into 
> the win32 api to behave differently based on the
> coreclr settings. (the FileName variable is identical in both cases).
> Am I doing something wrong?
> A verifier related question:  in do_mono_image_load(),  there are these 
> calls:
> mono_verifier_verify_pe_data().   this one requires image->raw_data_len 
> to be set.  (in verify_msdos_header)
> mono_verifier_load_pe_data().   this one actually sets 
> image->raw_data_len.  (in do_load_header)
> they're executed in the order above, which causes the first one to 
> always fail for me.
> Bye, Lucas
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list

More information about the Mono-devel-list mailing list