[Mono-dev] Making Mercury work with Mono

Jonathan Morgan jonmmorgan at gmail.com
Fri Apr 7 09:47:36 EDT 2006


Mercury is a logic programming language.  The researchers on it were
paid by Microsoft to develop an IL backend, which works with the
Microsoft .NET framework.  I am currently trying to make it work with
Mono.

The Mercury build process first compiles all Mercury code to IL. 
Foreign code can be specified as any of IL, C# or Managed C++, and
this will be placed into separate C# or MC++ files.  IL files are then
compiled to modules, the C# and MC++ files are also compiled into
modules, and then these are all linked into an assembly with al.

Mono ilasm builds all the IL files correctly, but then, when it tries
to build any of the C# files, it crashes with the following error
messages:

** (C:/Programs/Programming/Mono-1.1.12.1/lib/mono/1.0/mcs.exe:2312):
WARNING **: The following assembly referenced from
C:\cygwin\installs\mercury-compiler-0.12.2\tmp_dir\library\bool.dll
could not be loaded:

     Assembly:   mercury    (assemblyref_index=0)

     Version:    0.0.0.0

     Public Key: 228c167d12aa0b0b

The assembly was not found in the Global Assembly Cache, a path listed
in the MONO_PATH environment variable, or in the location of the
executing assembly (.).

** (C:/Programs/Programming/Mono-1.1.12.1/lib/mono/1.0/mcs.exe:2312):
WARNING **: The class mercury.bool.bool_0 could not be loaded, used in
mercury, Version= 0.0.0.0, Culture=neutral,
PublicKeyToken=228c167d12aa0b0b

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

It seems to me that the problem is that MS csc allows the use of
addmodule to build up assemblies, but Mono mcs doesn't.  It is failing
because it is trying to load the (completed) assembly mercury, when in
fact it is in the process of building that assembly, and modules that
form part of the assembly are referencing other modules that form part
of the assembly.  I don't think that proper multi-module/single
assembly building can be achieved without this feature.

Also, it seems that Mono ilasm produces complete assemblies, whereas
MS ilasm produces modules.  This means that if you try and use Mono
generated DLLs with MS csc it fails, stating that the dll is not a
module.  This too is not going to facilitate multi-module/single
assembly building.

Any ideas?

Jon



More information about the Mono-devel-list mailing list