Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
1.36/5 (4 votes)
See more:
Hello people,

Does anyone know any C# native compiler?

I read about ngen.exe BUT it still needs the .Net Framework... useless.

Everybody needs a REAL C# native compiler

Help!

Thanks a lot
Posted
Comments
Toli Cuturicu 14-Mar-11 18:50pm    
I need lots of stuff too... :-)

AFAIK there is no such animal. Since it's (Microsoft gestated) birth, C# has been closely integrated with .NET (also Microsoft gestated) and thus to CLR. I have to say that C# without .NET would be a poorer experience, since the deliberate lack of globals and the absolute requirement for both IEnumerable interfaces and the Garbage Collector mean it would be a crippled beast without them.

If you want native, learn C++.

If you want C#, learn .NET
 
Share this answer
 
Comments
pancho2413 12-Mar-11 16:29pm    
I know about the power of .net but the need of just a compiled prgram of my C# applications is so huge. I can't find how to do this. It's sad dude, I programm using C# but it's a real sadness to know that there's no way to protect my applications in C#, besides, do you know how much time do I have to spend for installing them including the f***ing needed 200MB framework 3.5 for just 400 KB of my app? I use some functions from this version but I don't need the whole framework... ;-(. BTW Do you know something about an expensive software called Salamandra? they offer something like a compiler for .net.
Sergey Alexandrovich Kryukov 12-Mar-11 18:48pm    
Do you think it's too much? Then wait when Windows will go. Bare .NET based OS will be much more compact than Windows + .NET (I hope). Please see my answer.
--SA
Sergey Alexandrovich Kryukov 12-Mar-11 18:49pm    
Griff, you're right, my 5.
--SA
Albin Abel 15-Mar-11 16:03pm    
Good choice given. My 5
Kornfeld Eliyahu Peter 16-Sep-14 11:52am    
For your eyes only - http://msdn.microsoft.com/en-us/vstudio/dotnetnative.aspx
Why would you need such a thing? C# has been designed to generate managed code whic runs in the .NET framework, not native code.
 
Share this answer
 
Comments
pancho2413 12-Mar-11 16:22pm    
C# is powerful but when I have to install an app in a new computer I need to install additional software such as the .Net Framwework 3.5 (200MB+ , that's insane!!!!) and I really need to use some functions that comes with this version.
Besides, security against decoding my apps is very important but if I have just the MSIL I will have a lot of risks.
I want to compile my program with those tools I use from the framework and nothing else (it's what everybody expect from a compiler :-D ), and take the compiled file/s to any pc
Sergey Alexandrovich Kryukov 12-Mar-11 18:46pm    
If this is your concern, just forget C#, but please see my answer.
--SA
Richard MacCutchan 13-Mar-11 4:28am    
In that case I suggest you switch to C++. If you want to use C# then you must accept the .NET framework that it runs in.
Sergey Alexandrovich Kryukov 12-Mar-11 18:49pm    
Richard, that's true, my 5.
--SA
Dalek Dave 13-Mar-11 8:13am    
nice observation.
I believe you do have a point - sometimes it's nice to have a single executable. I believe there is some indication that the mono folks[^] are toying with the idea - but it's probably not ready for "prime time" :) Needed for iPhone deployment - don't know if the functionality will be available for other platforms ...

You may find that Delphi XE is just what you need - you'll have to learn object pascal, but I guess you will find that there is a lot of similarities as both are heavily influenced by Anders Hejlsberg.
http://www.embarcadero.com/products/delphi[^]

Regards
Espen Harlinn
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 13-Mar-11 13:02pm    
Great idea, my 5. Sorry I failed to mention this, as you know I had very positive experience with Delphi and it gave me deeper understanding of .NET.
--SA
Espen Harlinn 13-Mar-11 13:53pm    
They still doesn't seem to be aware that the world is moving towards 64-bit on a fast track, and that they are seriously late for the party :)
Sergey Alexandrovich Kryukov 13-Mar-11 16:45pm    
Yes, this is a good point. However, 32-bit platform is nothing wrong and transition is smooth enough. It was so funny to read about moving to "32-bit technology" in the past, because the technology shift was not about number of bits (who cares much?) but overcoming of dreaded real mode (even though protected mode existed on 16-bit architecture, it was not enough to break the situation). That was much more fundamental shift.
--SA
Espen Harlinn 13-Mar-11 16:52pm    
The odd thing is - they have been promising us a 64-bit compiler for years - I've even considered moving some code to freepascal just to have 64-bit compatibility
Sergey Alexandrovich Kryukov 13-Mar-11 17:19pm    
Free Pascal might be a good way. I did not try much but I considered it when I realize I won't get more and more new versions of Delphi like it was in the past, and Delphi is not free, unlike C#, F#, etc. Also, Free Pascal with Lazarus (IDE) could be a way to cross-platform development, which I want. I would probably do more but Lazarus is too pathetic name... :-)
--SA
There's no such animal.

There are a couple of tools that integrate the .NET Framework into your .EXE, but as you've said, the .NET Framework is a 200MB download. Gues what happens to your .EXE when the required parts of the .NET Framework are embedded into your .EXE?? You guessed it, your .EXE becomes huge! And, they won't do what you want. Your .EXE is still going to be managed code, not native.
 
Share this answer
 
Comments
pancho2413 13-Jun-11 18:05pm    
Yeah you're right, and some people who wrote me too. We were really thinking about changing to C++ because of security but we decided to keep C# alive with us. Thanks Dave
Kornfeld Eliyahu Peter 16-Sep-14 11:52am    
For your eyes only - http://msdn.microsoft.com/en-us/vstudio/dotnetnative.aspx
Dave Kreskowiak 16-Sep-14 15:19pm    
Yeah, but this little question is over 3 years old now. That tool is still a Developer Preview and didn't exist back then.
Kornfeld Eliyahu Peter 17-Sep-14 1:43am    
I didn't realized it's an old question until after post...
Somehow it was on the first page of the 'All Questions'...
The only problem I can see is your lack of vision. It can change if you learn more about .NET. This is not a place to advocate .NET — this is not my purpose, so you might have well-justifying reasons to use native code only, but in his case you should forget C#. The only problem is that you don't understand why, because you don't feel the trend.

You probably live in different environment, but I haven't seen a single Windows system without .NET for several years. There is no thinking about the use of C# outside .NET (or compatible platform, see below). In need to know more about .NET to understand this. What's going on is just the opposite: Microsoft is working at new operating systems which will kick of the native Windows and make new systems based purely .NET (more exactly, on the CLR standard). Also, there are quite a few of other "sharp" languages used exclusively on .NET and compatible platforms.

Just to list some keywords: Singularity (http://en.wikipedia.org/wiki/Singularity_(operating_system)[^]), Midori (http://en.wikipedia.org/wiki/Midori[^]), Barrelfish (http://en.wikipedia.org/wiki/Barrelfish[^]). Third-party systems include SharpOS (http://en.wikipedia.org/wiki/SharpOS_(operating_system)[^]) and Cosmos (http://en.wikipedia.org/wiki/Cosmos_(operating_system)[^]). The same standard is supported on many existing systems with Mono (http://en.wikipedia.org/wiki/Mono_(software)[^]).

—SA
 
Share this answer
 
Comments
Albin Abel 15-Mar-11 16:01pm    
Good points. My 5
Sergey Alexandrovich Kryukov 15-Mar-11 17:42pm    
Thank you so much.
--SA
Keith.Badeau 12-Jun-11 16:32pm    
@SAKryukov:

I disagree with a couple of points you make. I don't see it as a lack of vision when one looks *past* Microsoft marketing hype, just the opposite.

I am a C/C++ & C# programmer so I am familiar with native and .NET environments, etc. I myself like the C# language but prefer the power of C++--though I am not saying C# isn't powerful but there are applications where a native program would be better suited.

When a programmer is trying to find a way to do something new (whether it is a good idea or not) we shouldn't ridicule them for "lack of vision" (makes me laugh because it doesn't take vision to see the future of Windows lays in .NET), we should try to offer our assistance and if we can't help then just shut our mouths.

Innovation and invention often come from a failed attempt at something completely different than was intended.
Sergey Alexandrovich Kryukov 12-Jun-11 16:41pm    
I agree with all what you say; I only don't understand on what basis you dismiss my opinion. Moreover, I tell something what is more or less in agreement in your views but under different point of view and in different terms. A lack of vision is a fact about most of us, including myself. There is nothing offensive in it. About OP, it's about the "useless" assessment in the question, first of all.

Also, the future of .NET is not a trivial matter. Yes, it does need vision to see it. The problem is the different: future is unpredictable, and I cannot be really sure about my assessment about vision. I hope it is taken for granted -- all I say about it cannot be a fact. What now I assess as good vision could be proven wrong in future. If it comes to .NET, it would be to my regret.

Respect,
--SA
Keith.Badeau 16-Jun-11 2:50am    
Forgive me, Apparently I interpreted the *intent* of your post wrongly and I can admit when I am wrong. I just have had it to my neck with posters that are demeaning to newbies or those that my not be as saavy in one area or another and so, my apologies.

You are correct that are views are in line but if you will allow me a moment to clarify my response. I 've been a hobbyist C/C++ programmer\hacker (in the sense that I consider myself a "hack") for the better part of fifteen years and I resisted .NET for the first seven years from its inception. I disagree with Microsofts inevitable path to complete reliance on the framework so I may have taken your statement (.NET, vision of...) personally.

Also, I always try to encourage experimentation, outside-the-box thinking, and, well...hacking away on the keyboard and attempts to try things others may think "crazy" or "pointless" because this is what we do.

I'm sure you can think of more than one project you've worked on that had gotten you a couple of jeers from naysayers. Also, I like the C# language though I am still not too fond of .NET--at least for my high-powered apps. ;)
Try this link:

http://blog.prabir.me/post/LLVM-e28093-Native-C-Compiler.aspx[^]

It is supposed to remove reliance on the .NET Framework by compiling to LLVM. To me this isn't much better a solution bit if I may suggest something it would be to rewrite your programs from C# to C or C++.

This may be your best bet because in C# the garbage collection, resource management is handled by the framework and as such would have to be implemented in your native app somehow.

There are just so many variables to consider that a native C# compiler would have to know how to handle these resources at compile-time rather than during run-time when the framework would normally do the work.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 16-Sep-14 15:36pm    
I did not try it, but this project looks very interesting at first glance. My 5.
—SA
I have recently finished the C# (MSIL) compiler to LLVM ByteCode which allows to compile C# directly into native code as C++ compiler does.

C# native compiler (Il2Bc) - https://csnative.codeplex.com/
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900