Macro remove define


I wonder if it’s possible to remove a define using macros.
For example if I want a define to be used only on compile-time and not on run-time, is it possible to remove it at the end of macro execution ?
If yes, where should I do that please since defines are supposed to be used in macro initializations ?
And if not, is there another solution than playing with another define so if this one is set, I ignore the previous ?
I don’t know if it’s clear…

Thanks for your reading

What do you mean by runtime here? Defines aren’t available at runtime.

Do you want to be able to do haxe.macro.Context.defined but not influence conditional compilation?

Compiler.define might be able to remove it by passing an empty value, not sure.
And while init macro do run before typing they can trigger typing, so you’d still have to be careful to remove it early enough.

Thanks Valentin for your reply.

Yes of course defines aren’t available on run-time. My explanation was bad.
I wanted to say having a define in a macro process and remove it for typing/generation.
But as you said I have to play by myself in the different macro contexts that’s all.

The main question in fact is how to remove a define because this doesn’t work :

trace( haxe.macro.Context.definedValue( "test" ) );    // null
haxe.macro.Compiler.define( "test" );
trace( haxe.macro.Context.definedValue( "test" ) );    // 1
haxe.macro.Compiler.define( "test", null );
trace( haxe.macro.Context.definedValue( "test" ) );    // 1

So the only solution would be to play with somethin like that test=on then test=off
And also haxe.compiler.define() is supposed to be used only in initialization macros, so I can’t remove it later…