ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Loughran <>
Subject Re: <csc> and Mono (was Re: cvs commit: ant/src/etc/testcases/taskdefs/optional dotnet.xml)
Date Wed, 06 Aug 2003 17:39:59 GMT
Stefan Bodewig wrote:
> On Tue, 05 Aug 2003, Steve Loughran <> wrote:
>>I see the default references are going to be trouble.
> More trouble than I had expected.
> After making sure that there was no trailing ; I get this here
> [...]
>       [csc] /usr/lib/System.dll is out of date
>       [csc] /usr/lib/corlib.dll is out of date
>       [csc] working from source directory /home/bodewig/ASF/jakarta/jakarta-ant/src/etc/testcases/taskdefs/optional
>       [csc] /home/bodewig/ASF/jakarta/jakarta-ant/src/etc/testcases/taskdefs/optional/dotnet/example.cs
is out of date
>       [csc] /home/bodewig/ASF/jakarta/jakarta-ant/src/etc/testcases/taskdefs/optional/dotnet/example2.cs
is out of date
>       [csc] compiling 2 files
> [... SNIPPED ...]
>       [csc] error CS0518: The predefined type `System.Object' is not defined
> and so on.
> First, obviously the /reference argument is not doing what I (being
> the C# neophyte I am) thought it would do (you describe it as
> CLASSPATH equivalent) - as its content is considered as something that
> may need a recompilation.
> When I drop the /nostdlib+ generated by
> includedefaultreferences="false", I get rid of these errors but the
> compilation fails as mcs now tries to write to the .dlls and fails (no
> permission to do so, of course).

what seemed a good idea of (a) having a predefined set of inclusions, 
and (b) having the turn-off-inclusions do two things, was clearly a 
mistake. Sorry.

> If I now also remove the /reference argument, things go OK until I hit
> error CS5001: Program /home/bodewig/ASF/jakarta/jakarta-ant/src/etc/testcases/taskdefs/optional/dotnet/build/ExampleCsc.exe
does not have an entry point defined
> which is quite close to what I'd expect from the task to emit as well.
> I think this is a second problem that we can try to solve later.

that's cool, that's just a no-main eror.

> Now the main problem is that includedefaultreferences does two things,
> it controls the /nostdlib argument and it also controls an implicit
> set of references that will be added as argument.  For Mono we do not
> want the second part as it references assemblies not present there.

yup. We either want no refs, or we want the mono refs.

> I feel a new attribute is getting close.  adddefaultreferences that by
> default takes the same value as includedefaultreferences?
> (best viewed with a non-proportional font 8-)
> adddefaultreferences | includedefaultreferences | effect
> =====================================================================
> true                 | true                     | /nostdlib+ and
>                      |                          | implicit /reference
> ---------------------------------------------------------------------
> true                 | false                    | /nostdlib- but
>                      |                          | implicit /reference
> ---------------------------------------------------------------------
> false                | true                     | /nostdlib+ and no
>                      |                          | implicit /reference
> ---------------------------------------------------------------------
> false                | false                    | /nostdlib- and no
>                      |                          | implicit /reference
> I don't think the second line makes sense, but anyway.  Mono users
> would then use the third combination.

I was thinking of something different, now that there is a <references> 
fileset in the task.

1. drop all predefined references the moment you name an executable on 
the command line. So only the stdlib goes in, the rest are missing

2. fix up the IsManagedExecutable() test to look at the flag in the PE 
header that says 'we are managed code'. I'd need to write a win32 app to 
  calculate the offset from winnt.h definitions, but then its easy.

3. have people include references that *somehow* refer to the files in 
version of .net they are building against.
<references dir="D:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\ 

I dont see an env variable on windows that points to the current version 
of .net, and you cannot hard code it. When you include stuff without 
giving a full path, the compiler searches the path. How can I say 
<fileset path="${env.PATH}" includes="System.dll"/>

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message