digitalmars.D.learn - Conditional compilation for debug/release
- Johan Engelen (13/13) Apr 06 2015 How do conditionally compile code for either release ("-release")
- Namespace (6/19) Apr 06 2015 debug {
- Johan Engelen (4/9) Apr 06 2015 Thanks for the quick reply!
- Namespace (4/14) Apr 06 2015 It's there already:
- Johan Engelen (4/20) Apr 06 2015 It was not obvious to me that "else" would work.
How do conditionally compile code for either release ("-release")
or debug ("-debug")?
Something like this:
version(Debug) {
pragma(lib, "libcmtd.lib");
} else {
pragma(lib, "libcmt.lib");
}
In the documentation [1], I don't see any predefined version
identifiers for this purpose.
Thanks,
Johan
[1] http://dlang.org/version.html
Apr 06 2015
On Monday, 6 April 2015 at 14:50:29 UTC, Johan Engelen wrote:
How do conditionally compile code for either release
("-release") or debug ("-debug")?
Something like this:
version(Debug) {
pragma(lib, "libcmtd.lib");
} else {
pragma(lib, "libcmt.lib");
}
In the documentation [1], I don't see any predefined version
identifiers for this purpose.
Thanks,
Johan
[1] http://dlang.org/version.html
debug {
pragma(lib, "libcmtd.lib");
} else {
pragma(lib, "libcmt.lib");
}
Apr 06 2015
On Monday, 6 April 2015 at 14:55:58 UTC, Namespace wrote:
debug {
pragma(lib, "libcmtd.lib");
} else {
pragma(lib, "libcmt.lib");
}
Thanks for the quick reply!
Worth adding an example like that to
http://dlang.org/version.html ?
Apr 06 2015
On Monday, 6 April 2015 at 15:15:48 UTC, Johan Engelen wrote:On Monday, 6 April 2015 at 14:55:58 UTC, Namespace wrote:It's there already: http://dlang.org/version.html#debug ;)debug { pragma(lib, "libcmtd.lib"); } else { pragma(lib, "libcmt.lib"); }Thanks for the quick reply! Worth adding an example like that to http://dlang.org/version.html ?
Apr 06 2015
On Monday, 6 April 2015 at 15:24:53 UTC, Namespace wrote:On Monday, 6 April 2015 at 15:15:48 UTC, Johan Engelen wrote:It was not obvious to me that "else" would work. But reading the whole page again (not just the "debug" part), I see that indeed the info is already there.On Monday, 6 April 2015 at 14:55:58 UTC, Namespace wrote:It's there already: http://dlang.org/version.html#debug ;)debug { pragma(lib, "libcmtd.lib"); } else { pragma(lib, "libcmt.lib"); }Thanks for the quick reply! Worth adding an example like that to http://dlang.org/version.html ?
Apr 06 2015








"Johan Engelen" <j j.nl>