[Mono-list] effect of -nostdlib option

jopryor jopryor@vt.edu
Mon, 3 Mar 2003 12:27:57 -0500


-nostdlib does two things.  It keeps corlib.dll from being loaded by default.

The second thing is what's causing you problems.  -nostdlib tells mcs to grab 
all types from the files it's compiling.  This includes the base types, such 
as System.Object (which you were getting errors about).

The only reason to use -nostdlib is when compiling corlib itself, which should 
use the types defined in corlib, *not* types definied in the previous version 
of corlib.

You shouldn't need -nostdlib.  It's "for internal use only." ;-)

 - Jon

>===== Original Message From Gert Driesen <gert.driesen@pandora.be> =====
>Hi,
>
>Can anyone explain what the effect of specifying the -nostdlib option is for 
the Mcs (using the Mono runtime or the .NET runtime) ?
>
>For the MS.NET compiler it allows you to specify another mscorlib.dll that 
should be linked instead of the .NET Framework mscorlib.dll.
>
>But for Mcs this does not seems to work :  when you want to build an assembly 
using the Mono runtime you must use "mono mcs.exe [options]" although in my 
opinion should be able to build an assembly using the Mono system assemblies 
by using the following commandline :
>
>mcs.exe -target:library -nostdlib -noconfig -out:log4net.dll -r:corlib.dll 
-r:System.dll -r:System.Xml.dll -r:System.Web.dll -recurse:*.cs
>
>But apparently it does not seems to link to the corlib.dll again, because I 
get the following compile errors :
>
>error CS0518: The predefined type `System.Object' is not defined
>error CS0518: The predefined type `System.ValueType' is not defined
>error CS0518: The predefined type `System.Attribute' is not defined
>error CS0518: The predefined type `System.IComparable' is not defined
>error CS0518: The predefined type `System.ICloneable' is not defined
>error CS0518: The predefined type `System.IConvertible' is not defined
>error CS0518: The predefined type `System.Collections.IEnumerable' is not 
defined
>error CS0518: The predefined type `System.Collections.ICollection' is not 
defined
>error CS0518: The predefined type `System.Collections.IEnumerator' is not 
defined
>......
>
>Can anyone explain what the -nostdlib option is for then, and how I can 
compile compile an assembly with the Mono system assemblies without using 
Mono.exe Mcs.exe ?
>
>Gert