[Mono-list] addmodule

Talbott Crowell tcrowell@thirdm.com
Mon, 10 Jun 2002 08:35:03 -0400


Below is the source code which is designed to demonstrate
that assemblies and namespaces have no relation to each
other.  Each file compiles to a different module within
the same assembly using Microsoft csc.  I can not get
it to work with Mono.

I am trying to compile one .cs source file into
a module and then compile a second .cs source file
adding the first module.  The destination needs to
be an exe that consists of two modules but one assembly.
To test it, the first .cs file contains a class with
internal accessibility and the second .cs file uses
the first internal class.  Using microsoft's compiler
it is done like this:

csc /target:module file1.cs
csc /addmodule:file1.netmodule file2.cs

I tried:

mcs --target module file1.cs
mcs -r file1.dll file2.cs

but that gave me errors because the file being generated
from the mcs --target module command is a dll and I can't
seem to assemble it with the file2 source.  If this is
not possible with the mono compiler, is there an 
al.exe (assembly linker) equivalent in Mono?

Here is the source for file1.cs:

//csc /target:module file1.cs
namespace F1 
{
    class ModuleExample 
    {
        internal string GetOutput() 
        {
            return "This is the output.";
        }
    }
}

Here is the source for file2.cs:

//csc /addmodule:file1.netmodule file2.cs
using F1;

namespace F2 
{
    class Module2 
    {
        static void Main() 
        {
            ModuleExample me = new ModuleExample();
            System.Console.WriteLine(me.GetOutput());
        }
    }
}

Sincerely
-Talbott

Talbott Crowell
Principal Consultant
Third Millennium, LLP