VB.NET Common Language Runtime questions

D

douglass_davis

Some things i do not understand about CLR if any one could clear this
up i would appreciate it.


1. When I compile a program in VB .NET 2003 and get an executable, does
that executable contain native code or Intermediate Language?

2. Is there somewhere a choice in VB .NET 2003 between compiling to
native code or to Intermediate Language?

3. Do ALL WIndows computers come with CLR? If not, and I give a user
an exe containing IL (if this is possible), how would a user go about
getting the CLR?

4. Do all Windows computers come with the Framework Class Libary? If
not, how would users obtain the FCL?
 
S

Scott M.

Some things i do not understand about CLR if any one could clear this
up i would appreciate it.


1. When I compile a program in VB .NET 2003 and get an executable, does
that executable contain native code or Intermediate Language?

It depends on how you compiled it. Normally, it would contain IL, and then
it is further compiled to native code when the assembly is used for the
first time. This usually results in a small startup delay for the first
caller of the assembly. If you wish to avoid this delay, you can use the
NGEN.exe tool to compile the assembly to native code pre-emptively.
2. Is there somewhere a choice in VB .NET 2003 between compiling to
native code or to Intermediate Language?

No, but as I indicated above, the external NGEN.exe tool can do native
compilations.
3. Do ALL WIndows computers come with CLR? If not, and I give a user
an exe containing IL (if this is possible), how would a user go about
getting the CLR?

Not yet. There are different versions of the CLR (because there are
different versions of the .NET Framework). For Windows XP, the .NET
Framework must be added via Windows Update. Windows Vista will have the .NET
Framework (and thus, the CLR) built in from the start.
4. Do all Windows computers come with the Framework Class Libary? If
not, how would users obtain the FCL?

See my answer to #3. The CLR and the FCL are both part of the larger .NET
Framework, you don't get the CLR and the FCL separately, if you have the
Framework, you've got everything you need to run .NET applications that were
written to run on the version of the Framework you have.
 
K

Kevin Spencer

The CLR (Common Language Runtime Library) is a vital part of the Microsoft.
..Net platform, a massive set of class libaries that all .Net applications
make use of.
1. When I compile a program in VB .NET 2003 and get an executable, does
that executable contain native code or Intermediate Language?

Intermediate Language.
2. Is there somewhere a choice in VB .NET 2003 between compiling to
native code or to Intermediate Language?

No, but there are command-line tools that can do this, such as NGEN.EXE (see
http://msdn2.microsoft.com/en-us/library/6t9t5wcf.aspx)
3. Do ALL WIndows computers come with CLR? If not, and I give a user
an exe containing IL (if this is possible), how would a user go about
getting the CLR?

No. Only Windows XP and Windows Server 2003 come with the CLR. You can add
the .Net Platform redistributable to a setup/deployment project. In
addition, it is available for all Windows versions (starting with Windows
2000) via Windows Update.
4. Do all Windows computers come with the Framework Class Libary? If
not, how would users obtain the FCL?

See my introduction. The Framework comes with the CLR. They are not separate
installations.

--
HTH,

Kevin Spencer
Microsoft MVP
Software Composer
http://unclechutney.blogspot.com

A watched clock never boils.
 
D

douglass_davis

Scott said:
It depends on how you compiled it. Normally, it would contain IL, and then
it is further compiled to native code when the assembly is used for the
first time. This usually results in a small startup delay for the first
caller of the assembly. If you wish to avoid this delay, you can use the
NGEN.exe tool to compile the assembly to native code pre-emptively.


No, but as I indicated above, the external NGEN.exe tool can do native
compilations.


Not yet. There are different versions of the CLR (because there are
different versions of the .NET Framework). For Windows XP, the .NET
Framework must be added via Windows Update. Windows Vista will have the .NET
Framework (and thus, the CLR) built in from the start.


See my answer to #3. The CLR and the FCL are both part of the larger .NET
Framework, you don't get the CLR and the FCL separately, if you have the
Framework, you've got everything you need to run .NET applications that were
written to run on the version of the Framework you have.

Okay, thanks for the answers... So, it only has to be compiled to
native code once? So then is there some directory where this compiled
code resides?
 
S

Scott M.

I believe the native code is loaded dynamically. The JIT process to native
code will occur for the first caller, each time the application starts. To
create the file permanently and avoid the JIT, use NGEN.exe.
 
D

douglass_davis

Scott said:
I believe the native code is loaded dynamically. The JIT process to native
code will occur for the first caller, each time the application starts. To
create the file permanently and avoid the JIT, use NGEN.exe.


okay. interesting.
 
C

Cor Ligthert [MVP]

Douglass,

Net is an extra layer on the OS. It contains one let say runtime, but it is
not a kind of runtime like we are used to. It is for all language that uses
the Net Managed code. However there is needed for every OS its own Net layer
(called framework).

One of to things you probably think direct about is that it is not so clever
to use OS API's in your programs, yes that is true.

Be aware that native code is seldom faster than code runned by a runtime (on
micro computers), while they will probably never be as small as an Net
assembly (other word for EXE or DLL, which is not a dynamic library)

Cor
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

okay. interesting.

Note, though, that if you use NGEN to create the native code, you lose
the benefits that the JIT brings. The code will be compiled to run on
any possible processor, and not optimized for the specific processor
that it will be run on.
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

okay. interesting.

Note, though, that if you use NGEN to create the native code, you lose
the benefits that the JIT brings. The code will be compiled to run on
any possible processor, and not optimized for the specific processor
that it will be run on.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top