C# question

Started by
6 comments, last by master_ball 19 years, 11 months ago
Does a C# have to be compiled to run on the CLR/.NET Framework? Is there anyway to write a C# program to be independant, and run as a standard executable, the same way a C++ program is written? I understand this defeats much of the purpose for using C#, but just out of curiosity, is it possible? Thanks~! -- master_ball -- ------------------------------ What?! I can''t spell, I''m a CS major!
-- master_ball --------------------------------student seeking future game dev career, advice welcome
Advertisement
quote:Original post by master_ball
I understand this defeats much of the purpose for using C#,
but just out of curiosity, is it possible?

It''s possible, sort of: http://www.remotesoft.com/linker/



--
AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.
[Project site] [Blog] [RSS] [Browse the source] [IRC channel]
--AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.[Project site] [IRC channel] [Blog]
I think that once you run a regular C# program the first time, the just-in-time compiler will compile it to a native .exe for your CPU and when you run it the second time it will just be a normal .exe.
quote:Original post by Matei
I think that once you run a regular C# program the first time, the just-in-time compiler will compile it to a native .exe for your CPU and when you run it the second time it will just be a normal .exe.

That doesn''t solve the deployment problem. I got the impression that was what the OP was most concerned about.

--AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.[Project site] [IRC channel] [Blog]
You can just distribute it as an exe but of course the .NET framework needs to be installed already. This will be integrated into the next version of Windows.
thanks~!
er thanks haha



-- master_ball --
------------------------------
What?! I can''t spell, I''m a CS major!
-- master_ball --------------------------------student seeking future game dev career, advice welcome
quote:Original post by Matei
I think that once you run a regular C# program the first time, the just-in-time compiler will compile it to a native .exe for your CPU and when you run it the second time it will just be a normal .exe.


No, it won''t.

Running it does not change the .exe in the slightest. If the compiler makes native code out of it (which it does by default, I believe), it will store it in memory (possibly even in a cache on disc), but it won''t affect the original .exe

And next time you run it, it will likely need to do it again (unless it has some kind of cache).

Believe me, this is a feature, not a bug.

If it is subsequently run on a different platform (win64, WinCE for instance, or even a non M$ platform), then the compiler there (if it has one), will compile it differently for its own CPU.

In any case even if you could make a native .exe, that would not remove the dependency on the large .NET framework which must be installed separately.

Mark

This topic is closed to new replies.

Advertisement