compile to native

M

Marcus

How can I compile my VS2005 c# code to not be dependent on CLR to run?

I want people that install my software to be able to run it without
having to bother with CLR's and "Windows installers".


I would like to generate a binary for lets say Windows XP.

How do I do this?
 
T

Tom Spink

Marcus said:
How can I compile my VS2005 c# code to not be dependent on CLR to run?

I want people that install my software to be able to run it without
having to bother with CLR's and "Windows installers".


I would like to generate a binary for lets say Windows XP.

How do I do this?

Hi Marcus,

I've heard of something called NGen, something to do with native generation
I think. It may be what you're looking for, but be warned: C# isn't
designed for this. It's /supposed/ to be dependant on the CLR. That's
it's whole purpose, in fact.
 
P

pvdg42

Marcus said:
How can I compile my VS2005 c# code to not be dependent on CLR to run?

I want people that install my software to be able to run it without
having to bother with CLR's and "Windows installers".


I would like to generate a binary for lets say Windows XP.

How do I do this?
To add to Tom's admonition. The language *designed* for what you want
(available in Visual Studio) is C++.
 
S

ssamuel

Marcus,

I'm sure this has some limitations, but here's the answer to how to run
..NET code without the CLR installed:

http://www.xenocode.com/


Tom,

NGen simply optimizes code for a particular local machine/platform. For
instance, if you're running an AMD processor, NGen will give you code
that may take advantage of some AMD-specific function calls. Something
like that. You still need the CLR.


Stephan
 
?

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

ssamuel said:
NGen simply optimizes code for a particular local machine/platform. For
instance, if you're running an AMD processor, NGen will give you code
that may take advantage of some AMD-specific function calls. Something
like that. You still need the CLR.

You might be able to make specifically targeted builds, but normally you
would make a build targeted at any processor. That disables any specific
optimizations.

The JIT compiler on the other hand can always use specific
optimizations, as it always knows what processor the code will be run
on. So in practice it's the other way around; NGen creates an
un-optimized build.
 
T

Tom Spink

ssamuel said:
Marcus,

I'm sure this has some limitations, but here's the answer to how to run
.NET code without the CLR installed:

http://www.xenocode.com/


Tom,

NGen simply optimizes code for a particular local machine/platform. For
instance, if you're running an AMD processor, NGen will give you code
that may take advantage of some AMD-specific function calls. Something
like that. You still need the CLR.


Stephan

Cool. Cheers, Stephan.
 
J

Jon Skeet [C# MVP]

Göran Andersson said:
You might be able to make specifically targeted builds, but normally you
would make a build targeted at any processor. That disables any specific
optimizations.

The JIT compiler on the other hand can always use specific
optimizations, as it always knows what processor the code will be run
on. So in practice it's the other way around; NGen creates an
un-optimized build.

While NGen doesn't perform all the optimisations (for reasons I'm not
clear on) it *does* know which processor it will be run on - if you
change processor, the NGen'd code won't be used any more.
 

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