December 19, 2010
Nick Sabalausky Wrote:

> 
> The problem with that is, what if you're generating target-platform-specific code at compile-time? You'd be generating code for the wrong platform. I think VladD2 is right: You need to keep track of both "current" system and "target" system. Unfortunately, there is some information about the "target" system the compile-time code wouldn't be able discern without giving it the ability to run code (RPC? Virtualization? Really, really good emulator?) on the target system, but then again, that's a limitation with any cross-compiling scenario.
> 
> 

I don't understand this. If you're talking about version blocks, obviously all the current D compile time features are incompatible with the macro system. They're also redundant cause you can (and should) simply write instead:

macro (version) {
  if (version == Version.Linux) { ...}
}

Also, the macro dll is compiled for some platform Z and will only be loadable by a compiler that also runs on platform Z.  I don't think that macros need to be cross-compiled for our (X,Y) scenario, they need to evaluate a TargetPlatform parameter at their run-time which the cross-compiler will provide (much like current D have predefined version identifiers defined by the compiler)