Boost logo

Boost-Build :

From: Reece Dunn (msclrhd_at_[hidden])
Date: 2005-09-15 18:19:31


Andrey Melnikov wrote:
> Reece Dunn wrote:
>
>>Andrey Melnikov wrote:
>>
>>>Reece Dunn wrote:
>>>
>>>>Hi All,
>>>>
>>>>[1] warnings support (designed for genericity, only supported in msvc
>>>>for now).
[snip]
> So I'd like to have:
>
> all # enable all warnings but disable "deprecated" and 64-bit ones
> (-W4 -wd0000)
> strict # same as all, but be stricter about warnings
> # (-W4 -Wp64)

/wd0000 gives the following error:

cl : Command line warning D4014 : invalid value '0' for '/wd'; assuming
'4999'

>>>>[4] support for managed (CLR) and Java bytecode
>>>>
>>>>feature clr :
>>>> cppcli # Use the new C++/CLI (VC8-style) style CLR
>>>> managed # Use old-style (VC7.x-style) managed code syntax
>>>> pure # Use C++/CLI (VC8-style) pure CLR
>>>> safe # Use C++/CLI (VC8-style) safe (validated) CLR
>>>> : propagated ;
>>>
>>>Is this a MC++-specific, a CLR-specific feature? It looks like it's a
>>>MC++-specific feature. Does it affect code generation, compile-time
>>>checks, C++ language extensions or both?
>>
>>MC++ is the C++ way to target to .NET (i.e. the CLR).
>
> Not exactly. IMO "MC++" means the extension to the C++ language that allows:
> 1) to mix native and managed code
> 2) to use all the features of CIL and CLI in C++

The "managed" option is a poor name and hence I think where some
confusion lies (but see below). What managed means is "vc7x-syntax". So
that should be updated.

> I think it's possible to write a compiler that will produce CIL from
>
> class CMyManaged
> {
> int x()
> {
> return 2;
> }
> }
>
> without a need for language extensions.

Sure.

> If it's possible (and especially if GCC-CIL goes this way) the feature
> won't be Microsoft-specific but will be CLR-specific.
>
> Also IMO "pure" means "no native code" and "safe" means "portable, no
> indirect PInvoke calls". I haven't written a line for the CLR in my
> life, so my comments can be lame here :)

Here is another attempt at this:

Normally, a compiler targets a specific CPU architecture to generate
machine code/assembler for that CPU. This is "native" compilation.

Java compiles to an intermediate bytecode that the Java Virtual Machine
(JVM) runs. This allows Java to run on any platform that has a JVM
installed.

Microsoft have added facilities for their .NET platform, which is
another bytecode (Intermediate Language) system running on the Common
Library Runtime (CLR). C#, VB.NET and others implicitly target the CLR
like Java targets the JVM.

Other compilers are providing a bytecode/intermediate form as an
optional target.

So, if we have:

# builtin.jam
feature bytecode :
native # target native CPU machine code
java # target the JVM machine code
dotnet # target the .NET/CLR machine code
cil # other (e.g. GCC) intermediate representation
;

VC++ can be told to target "native" platforms, or enable a mixed mode
that you can use to write .NET (managed) components. The "old-style"
(VC7.x) syntax uses __gc and other keywords. The VC8.0 compiler supports
C++/CLI as a new syntax for writing .NET components.

>From the documentation:

/clr:pure
Produces an MSIL-only output file with no native executable code,
although it can contain native types compiled to MSIL.

/clr:safe
Produces an MSIL-only (no native executable code) and verifiable output
file. /clr:safe enables verification diagnostics (PEVerify Tool
(Peverify.exe)).

# msvc.jam or dotnet.jam
feature clr : cppcli managed pure safe ;

with:

if [ VC7.x ]
{
<bytecode>dotnet : /clr ;
}
else
{
<bytecode>dotnet/<clr>cppcli : /clr ;
<bytecode>dotnet/<clr>managed : /clr:oldSyntax ;
<bytecode>dotnet/<clr>pure : /clr:pure ;
<bytecode>dotnet/<clr>save : /clr:safe ;
}

Note, we could replace "safe" with "verifiable"/"verify".

- Reece

 


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk