You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I experienced this with the C# target, but it might fit for others as well:
I wanted to add [System.STAThread] to the main entry point of my project, but this is not possible, because it is hardcoded into the compiler code. I think it would be better if the compiler could check for an existing "Main" function or to add some other option to change the entry point class.
I had to work around this by writing a script that edits hxcs_build.txt's "main" section to point to the following Haxe class:
class MainHook
{
@:meta(System.STAThread)
public static function Main() : Void
{
cs.Boot.init();
untyped CloudShelter.main();
}
}
and start haxelib run hxcs hxcs_build.txt manually.
I'm sorry if there already is a better way of handling this, I did not find any information about it.
The text was updated successfully, but these errors were encountered:
I found an alternative to above that's worked for me so far. Even though this thread is ancient, I'm putting this here for others looking for a fix. Also want to reiterate that there's probably a better way to do this.
Adding @:classCode("[System.STAThread]\n") above your main class definition generates the expected code.
Note: This is not a very stable alternative as we're banking on the fact that Main() is generated/inserted first. If this changes, this 'fix' would no longer work. However, this gets around having to create a shim entrypoint and build manually with a modified hxcs_build.txt.
I experienced this with the C# target, but it might fit for others as well:
I wanted to add [System.STAThread] to the main entry point of my project, but this is not possible, because it is hardcoded into the compiler code. I think it would be better if the compiler could check for an existing "Main" function or to add some other option to change the entry point class.
I had to work around this by writing a script that edits hxcs_build.txt's "main" section to point to the following Haxe class:
and start haxelib run hxcs hxcs_build.txt manually.
I'm sorry if there already is a better way of handling this, I did not find any information about it.
The text was updated successfully, but these errors were encountered: