Why gcc supports Java and not C #

I've seen this question and I'm wondering if there are any technical reasons to justify the fact that gcc offers Java support, but not for C #. If I understand Java is also an interpreted language. If Mono offers a C # compiler and a CIL implementation, why not create a gcc C # compiler that converts C # to IL and then copies it statically?


source to share

2 answers

If the compiler toolchain does not support a particular language, it is often because there is not enough interest in that language yet. So, not a technical reason in and of itself - it's just that they don't want to waste developer time on this, yet.

There is no particular technical reason why C # theoretically cannot be implemented as a statically compiled language. In practice, however, generics are one of the main strengths of C #, but unfortunately, because of the way generics work in this particular language, any efficient implementation of them generally benefits from the presence of a JIT compiler. When you define a generic type in C #, you can effectively end up with a chunk of machine code for all of its specific types, where the type arguments are classes and one piece of machine code for each of the struct types used. However, when you are trying to create a new concrete type in another binary, your most likely ally in creating the new chunk of machine code required for those type arguments is the JIT compiler.

If you are interested in building statically linked programs in C # (but not in gcc), then Mono offers a tool (called mkbundle, I think) that allows you to create completely self-contained binaries from C # code.



Because you haven't submitted a patch to add C # support.



All Articles