[Mono-list] effect of -nostdlib option

jopryor jopryor@vt.edu
Mon, 3 Mar 2003 14:26:09 -0500


You might try using the -noconfig compiler option, which prevents loading the 
default assemblies, and then reference the mono assemblies:

    mcs.exe -target:library -noconfig -out:log4net.dll -r:corlib.dll
        -r:System.dll -r:System.Xml.dll -r:System.Web.dll -recurse:*.cs

Alas, I don't have a Windows box to try this on, but I would expect this to 
work.  Just make sure that the referenced assemblies are in the current 
directory (corlib.dll, etc.)

 - Jon

>===== Original Message From Gert Driesen <gert.driesen@pandora.be> =====
>Hi Jon,
>
>What you're actually saying is that it's not possible to use Mcs.exe on
>Windows to compile an assembly using the Mono system assemblies, without
>running it using the Mono runtime.
>
>I was hoping I could use the -nostblib option to force Mcs not to load the
>MS.NET corlib.  But I guess it's not possible, right ?
>
>Gert
>
>----- Original Message -----
>From: "jopryor" <jopryor@vt.edu>
>To: "Gert Driesen" <gert.driesen@pandora.be>; "mono-list"
><mono-list@lists.ximian.com>
>Sent: Monday, March 03, 2003 6:27 PM
>Subject: RE: [Mono-list] effect of -nostdlib option
>
>
>> -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
>>
>>
>>
>
>_______________________________________________
>Mono-list maillist  -  Mono-list@lists.ximian.com
>http://lists.ximian.com/mailman/listinfo/mono-list