[Mono-list] effect of -nostdlib option

Ian MacLean ianm@ActiveState.com
Tue, 04 Mar 2003 13:59:58 +0900


Jon wrote:

>>-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).

Hmm I think the second part is incorrect behaviour. if you add a 
reference to another corlib then it should find the types there. If you 
use csc.exe with the following commandline:

csc -nostdlib -r:C:\mono-0.20\install\lib\corlib.dll Class1.cs

it works fine. However with

csc -nostdlib -r:C:\mono-0.20\install\lib\corlib.dll Class1.cs it fails. 
  I don't think there is anything in the docs on -nostdlib that indicate 
that the compiler should ignore all -r flags when its set.

>>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." ;-)

really ? thats not the impression I get from reading the ms docs on 
nostdlib.

Ian