Change arguments for the compiler by macros?

Dear community,

is it possible to change the arguments, passed to the compiler, to be manipulated by a macro?

I would find it very practicle for PHP compilation.

So it would be possible to automatically correct the library path ( --php-lib phpLibFolder ).

At the moment the argument sets the path relative to the index.php file.

It would be great to be able to automatically have it set to the equivalent folder of ‘src’ (classpath folder/ topLevel folder).

To manipulate the array you retrieve with Sys.args(); is pointless. It’s apperently just a copy of the args.

Is there a regular way? Or is there a sinister hack? I am looking forward to your suggestions.

Kind regards

With Haxe 4, the --php-lib phpLibFolder became -D php-lib phpLibFolder, in which case use can just use Compiler.define to set the variable. It’s quite possible that with Haxe 3, it will have the same effect, but you’ll have to try :wink:


Hello Juraj,

I have tried back and forth…

But at the moment (HAXE 3.4.7) it doesn’t seem to be possible.

For the time being I will have a work-around. I simply check, if the conditions, set in the .hxml file, match the concept and have an error thrown, if this is not the case.

So thanks for your reply. It helped a lot.

And I am looking forward for the final release of HAXE 4.0.0.

Kind regards