[Mono-list] Static CIL Libraries
Fergus Henderson
fjh@cs.mu.oz.au
Sun, 20 Oct 2002 15:35:35 +1000
On 18-Oct-2002, Jonathan Pryor <jonpryor@vt.edu> wrote:
> On Fri, 2002-10-18 at 07:46, Fergus Henderson wrote:
> > On 17-Oct-2002, Daniel Morgan <danmorg@sc.rr.com> wrote:
> <snip/>
> > | 3. Assembly resolution at static link time.
> > |
> > | .NET assumes a particular model of symbol resolution where the
> > | decision of which assembly (the .NET unit of distribution)
> > | each symbol belongs to is determined *at compile time*.
> > | Mercury has a different model, where at compile time we only resolve
> > | which *compilation unit* (which in Mercury are called "modules")
> > | each symbol belongs to. Then at *static link time*, compilation
> > | units are grouped into "libraries" (the Mercury unit of distribution).
> > | Only then, at static link time rather than at compile time,
> > | can it be determined which distribution unit (i.e. assembly)
> > | each symbol reference refers to.
>
> .NET permits this with multi-file assemblies. The names are different,
> but I believe the results are the same.
Nope.
> Name translation:
> "compile time" --> "creation of .netmodule file"
> "static link time" --> "creation of assembly"
The problem is that you need to fill in the "assembly" field for all
symbol references at IL generation time.
For example, if you want to call the function foo in class bar,
then you need to generate the IL instruction
call void [foo]bar.baz(void)
where "foo" is the assembly in which class bar resides.
If you leave the assembly reference off, i.e.
call void bar.baz(void)
then it means that the class bar must be located in the same assembly.
If it is not, then you get undefined class errors at runtime.
With traditional linking, you can generate a call to bar.baz
without needing to know which .so file will end up defining bar.baz.
--
Fergus Henderson <fjh@cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.