6 Months Free & No Setup Fees ASP.NET Hosting!
Skip Navigation Links
Home
Forum Home
Latest 50
Unanswered
Win Prizes
All Time Leaders
Jump to CategoryExpand Jump to Category
Login 
    Welcome Guest!
 Search Forum For :  
X
 Login
Please login to submit a new post, reply and edit exiting posts, see user profiles, and access more features. If you are not a registered member, Register here.
User Id / Email:
Password:  
Forgot Password | Forgot UserName
   Home » C# Language » Native C# compiler
       
Author Reply
Florian
posted 2 posts
since Feb 03, 2012 
from

Native C# compiler

  Posted on: 03 Feb 2012       
I was just thinking  about the following...

"A C# compiler that compiles C# source code to  native machine code that doesn't need the Common Language Runtime (CLR) to  execute."

How can this be accomplished?

Well, theoretically it  shouldn't be so hard. It's already possible to generate native machine code for  managed assemblies using the NGEN utility. The only problem is: These  assemblies still need the CLR to be executed. So, how can we get rid of this  (heavy) dependency?

The idea is: A small, native C# runtime library,  like the GNU libc for C.

What about memory management? The C# language  doesn't support explicit memory management, and if there is no CLR, how do we  handle "new"? Well, one solution are smart pointers. The C# compiler/runtime  library could take care of object lifetime management and use smart  pointers under the hood.

What about reflection and interoperability? The  native libraries could still use the CLI metadata format. In fact,  a similar approach is used already in Windows 8 for the Windows Runtime:  Native COM objects are exposed through .winmd files to the C#  compiler.

Well, would such a compiler be useful to anybody? I like  the C# language a lot and would prefer to use it for system programming over C++  because it has a very clean structure and is well architected. The problem is  the CLR, its the security model etc. which comes at a pretty high cost, not to  speak of crossing the managed/unmanaged code barrier using platform invocation  services. Having a C# compiler that translates your source files directly to  machine code, with a neat C# runtime library instead of a CLR as the only  dependency, doesn't seem such a bad idea to me.

What do you think of this  topic?
Vulpes
posted  5113 posts
since  Feb 28, 2011 
from 

 Re: Native C# compiler
  Posted on: 03 Feb 2012        0  
You might be interested in Vala.

Check out my article on the subject:

http://www.c-sharpcorner.com/uploadfile/b942f9/anyone-for-vala/
Florian
posted  2 posts
since  Feb 03, 2012 
from 

 Re: Native C# compiler
  Posted on: 09 Feb 2012        0  
I heard of Vala and it comes close: Vala simply isn't C# - what I'm talking about is a standard-compatible (ECMA-334) C# compiler that directly generates machine code rather than MSIL, linked to a native glibc-like standard library that uses the .NET metadata format (or something alike) to expose the types defined in ECMA TR-084. This is sort of the approach Microsoft has taken for the Windows Runtime, except for the fact that code in C# wouldn't depend on the CLR anymore (applications written in C# targeting the WinRT are still managed code and require the CLR).
Vulpes
posted  5113 posts
since  Feb 28, 2011 
from 

 Re: Native C# compiler
  Posted on: 10 Feb 2012        0  
Whilst it's true that Vala isn't C#, I suspect it's the nearest you'll ever get to 'unmanaged C#' in practice.

I can't see the Mono guys being interested in the idea when Vala is already available under the GNOME umbrella even if it is taking 'years' to reach version 1.0.

Microsoft have plenty on their plate with Windows 8 and, as they're already offering three platforms for Metro development, I can't see them wanting to muddy the waters with anything else.

Also, most system programmers will be content to stick with the C/C++ they know and love.
       
Top Articles
View all »
Team Foundation Server Hosting
Dynamic PDF
ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
Introducing MaxV - one click. infinite control. Hyper-V Hosting from MaximumASP.
Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Nevron Chart for .NET 2010.1 Now Available
The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
ASP.NET 4 Hosting
Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites – Click Here!

 Hosted by MaximumASP  |  Found a broken link?  |  Contact Us  |  Terms & conditions  |  Privacy Policy  |  Site Map  |  Advertise with us
Current Version: 5.2011.3.12
 © 1999 - 2012  Mindcracker LLC. All Rights Reserved