Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.

Using versions to store multiple programs in one file

Part of VersioningCategory

Description

Rather than having multiple programs, just have one that compiles for a variety of settings.

Example

/*
Version.d - the versioning example.
Written by Ameer Armaly, and in the public domain.
*/
//you can version for different os's like so:
version(linux
{
import std.c.linux.linux;
}
version(Win32)
{
import std.c.windows.windows;
}
//or for different environments

version(fast)
{
//whatever makes it runf aster
}
version(small)
{
//whatever makes it smaller
}

Source

Originally contributed by "Anonymous" on Sun Jul 25, 2004.

Link http://www.dsource.org/tutorials/index.php?show_example=106
Edited by jcc7
Date/Time Thu Sep 23, 2004 9:31 pm