Sunday 17 January 2010

C# Native Compiler

I was wondering the other day about all the (failed) attempts by Borland/Inprise/Borland/Codegear/Embarcadero (that list there says a lot just by itself) at diversifying their native Delphi compiler. You had Kylix (Delphi for Linux), Delphi for .NET, and C# Builder. All of them not really what you would call successful. Now they are working on a cross-platform compiler, which will be the next version of Delphi. (I still don’t get why they think this is more urgent that a 64-bit compiler)

Has anyone ever contemplated a native C# compiler? I don’t mean something that could take existing C# projects and compile them for Win32. Delphi for .NET showed that the two platforms are just too different for that to ever work in either direction. No, what I’m thinking about is a C# native compiler built on the VCL and the Delphi IDE. I think we all agree that there is a place for native development. There’s a load of C# developers out there though, who would never contemplate Delphi, but if they needed to write some native code, they would certainly look at a C# native compiler.

If that worked, it would definitely save Delphi. As long as the VCL was alive, and you had the same kind of compatibility you now have between C++ builder and Delphi, then Delphi would be back in the limelight.

Just a thought.

15 comments:

Anonymous said...

It's called C++, or if you prefer something more portable, try Java.

C# is less language than framework - the same is true for all dotNet languages.

Anonymous said...

The Mono guys have come up with something like this for the IPhone.
It's called Mono-Touch. I've played with it on my Mac and it works great.
That said, I don't see the point in competing with MS/Mono in the C# arena.

Azeroth said...

Or even better - make Delphi support Pascal and C# syntax.

Panayiotis said...

Take a loook at .NET Internals and Native Compiling at http://www.ntcore.com/files/netint_native.htm

Mohammed Nasman said...

Or make Delphi prism a win32 compiler.

it has very nice syntax, and will compete with c# more than Delphi win32.

Unknown said...

The COSMOS guys have a IL to ASM compiler: http://www.gocosmos.org/docs/Dev/FromCSharpToBoot.EN.aspx

--jeroen

LDS said...

What would be the benefit? If you choose C# is not for its syntax only. MS too didn't care about it. And when someone needs native code, usually needs something like pointers too :) Both C# and Java are designed with their VM, JIT and frameworks in mind.
Embarcadero is already enough scarce on resources - that would be another compiler to write and mantain. The only benefit I can see is that C# is fashionable now while Pascal is not - but IMHO it is not enough to attract developers to something that could look like a depowered C# - with a wholly different library.

Sean said...

Mono has an ahead-of-time compiling option which created native exes. It's mostly used in monotouch but can be used in windows exes as well

william said...

Leave C# for .NET and save the time/resource to work on 64bit native Delphi.

Anonymous said...

If they can make it support the VCL as-is, I would jump at it. Pascal is too verbose.

But too much effort for too little gain.

deksden said...

Why not to make multi-language tool?

Why I can not use some c++ classes in Delphi code? Or even inherit Delphi class from C++ class?

Why i can not use C/C++ RTL in my Delphi application? A lot of C libraries exists, and Delphi is limited in using them. And a lot of problems to use C++ library in Delphi application.

Unknown said...

The Gnome linux guys have such a language: VALA.
It's c# syntax, but compiles natively. It's even supported in the MonoDevelop IDE.

I've personally never tried it, but it looks like behind the scenes it automagically converts all your c# into plain-c code, links in a bunch of supporting libraries, and then compiles that all together into a native EXE.

http://live.gnome.org/Vala

http://en.wikipedia.org/wiki/Vala_%28programming_language%29

Anonymous said...

As to a native compiler for C# (and every other first class .NET language, including Delphi Prism which I like a Great Deal, see the following:
http://msdn.microsoft.com/en-us/library/6t9t5wcf(VS.80).aspx

M$ already thought of that when they released .NET, it's called the Native Image Generator or NGEN. Look for it in your Visual Studio install or with the SDK, you should already have it.

deksden said...

IMHO, ngen is slightly different thing. Ngen compile only application code, but large part of framework leaved as is. No linking with rtl. Maybe it is like Delphi's "compile with run time packages".

But native c# compiler must be supplied with framework(and rtl), and is able to link rtl with application.

Anonymous said...

@deksden: you can't use C++ class from Delphi for a couple of reasons: first their inner implementations are different, and IIRC you have issue to use C++ classes among different C++ compilers too.
That's why most libraries use plain C functions or wrappers like COM (i.e. Windows 7 ribbon API).
Actually Delphi can easily use C code both in .obj and .dll files (not .lib, which often are compiler dependent). C++ is different.