C# generation creates loads of "side" classes and files: how to prevent that

Hi there,

I have 1 Main.hx file with just over 100 lines of code. I use Std.parseInt and arrays.
When I tell the haxe compiler to only generate the c# code, it also creates loads of classes on top of my very simple haxe class.

Is there a way to prevent that ? Or is there a way to only generate 1 cs file with all the needed classes ?

Thx.

Nope, unfortunately the C# target is currently not very optimized for hello-world size programs and it always generates some support code even if it’s not actually used. There were some improvements in Haxe 4 regarding that, but it’s still not perfect.

Heh … Lots of systems do that sort of thing, although they’re usually generating object-code not source so you don’t so-readily see it. Back in the day, I tried very hard to get Delphi to produce a “command-line hello-world program” that was smaller than a couple megabytes but never succeeded. :slight_smile:

But it’s okay, of course, because you don’t use Delphi to produce “command-line hello-world programs.” When you start building the kind of stuff that the tool was made for, the foundational code that it adds in will probably be used. “Minimizing output file-size” is not a significant design consideration, within reason, as long as it works.

(And of course, the C# compiler might “optimize away” a lot of the cruft as it generates a final binary.)

Allright, thx for the reply !