C# compiler not for .NET?

Does anybody know a C# compiler which does produce something different than .NET-bytecode?

Greetings
Peter

I know the Unity engine use C# without .NET.
Not that it’s available for Haiku though…

Thanks for the info. I will have a look at Unity. Unfortunately it’s proprietaty afaik.

Greetings
Peter

Not that I’m aware of. C# has been designed for .NET and although it’s a great language, it would not have much sense without it.
There were at least two attempts to generate native executables from c#.NET one is SharpLang and it’s successor coreRT but both appear to be abandoned.
NativeAOT seams dead as well.
But all require .NET Framework or Core.

I have not seen any reference to C# without .NET, on the contrary on their site they claim to support .NET 4.6 for scripting and a backend which translates IL to native code. But it seems to require .NET anyway. Could you provide some links about it?

More about this. C# memory model is fully managed by the CLR. It is possible to use unsafe structures by marshalling native code. I doubt there is an easy way to produce native code without significantly changing the underlying architecture unless you transpile it to another similar language, maybe.

Can you tell me more of C#'s memory model? Or post a link about it?

Greetings
Peter

I think it was this post but it was a few years ago: On DOTS: C++ & C# | Unity Blog

1 Like

Godot engine use mono and Godot are ported to haiku, but mono dont.

Unity can transpile C# to C++. This gives less overhead on the runtime.

There is a dot net framework platform called “dotNet anywhere”. It was used in an early version of Blazor. It is easy to port. I have it run in on PSP for example. But the compiler is an issue, there is no good small C# compiler, so you need the framework to make a port properly viable with a compiler.

2 Likes

Google is your friend but there are two old good articles on MSDN: The C# Memory Model in Theory and Practice part 1 and part 2

1 Like

It’s an interesting article! Thanks for sharing it.

2 Likes

That sounds like what early Android developers did using the OpenJava compiler with a custom system-specific runtime. C# would be a better environment without the dotnet dependencies. Even a 68000 based Amiga can run Java once you dump Classpath and do a custom runtime engine.

2 Likes

Godot also supports C# syntax while output is compiled executable and not the byte code compiled executable manifest (IKR). Godot is a portable game development IDE that also supports a fairly decent set of interfaces with the host OS (like open file dialogs; etc.) and is about 100MB.

Beef (Beeflang) uses the LLVM toolchain, produces binary executables while using syntax very similar to C# and has its own GUI IDE. I always thought C# should have had a binary compiler myself thus began watching Beef.

1 Like

There is ongoing work porting C#/.Net to Haiku, which is coming along quite nicely.

4 Likes

Could you provide more details on this? Is there a GitHub repository?

1 Like
2 Likes

The replies by @jessicah, @Nexus-6 and @SamuraiCrow should be moved to this thread imho:

https://discuss.haiku-os.org/t/haiku-net/12399/6

Just for better reading.

Greetings
Peter

Possibly. I will point you to the PSP stuff I did though. It all words on PSP, and the native code is compiled in to a single EXE because PSP does not like loading external libs apparently. I started to add a PSP specific namespace for PSP wrappers, so it is possible to do whatever is needed really.

C# also would not be very useful without the System namespace, because it is where most of the basic stuff is defined.