On Monday, 23 March 2015 at 15:30:43 UTC, Ben Boeckel wrote:
On Mon, Mar 23, 2015 at 14:04:30 +0000, Dicebot via Digitalmars-d-announce wrote:
If you mean separate compilation with different flags per module and linking into same binary - it is pretty much illegal in D and can only be done at own risk. I don't know if it is mentioned anyway on dlang.org but that is inevitable side-effect of how symbol emitting works.

Makes sense for -fversion and the like (it would be nice if libraries exported the list of version symbols they had since it is basically ABI...), but not necessarily for things like SSE support where you want to do runtime detection and run the fastest version based on the running processor. You might need to compile foo.bar.sse3 and foo.bar.sse4 with
different compiler flags.

I'd suggest to build such modules as separate static libraries (which is possible within dub). Risk remains but it at least becomes obvious for other developers that this needs care. Also parallel build of several static libraries should be generally faster than parallel builds of all modules 1-by-1 (overhead of single file compilation is huge because of redundant import analysis)

Also don't forget that there are plenty of implicit versions that get added from compiler flags (like D_NoBoundsChecks or D_PIC).

Reply via email to