Advanced Configuration of Tango
Every Tango installation should begin with the Installation Guide. Once Tango is installed and working properly however, some users may wish to reconfigure Tango to meet specific needs. What follows is a brief outline of the Tango static library structure and some information on how to replace or modify various parts of Tango.
The Tango runtime is made up of three logically separate parts:
- a compiler runtime library,
- a garbage collector,
- and a common application layer.
These sub-libraries interact via a set of well-defined function calls (described in the Library Integration Guide) and they do not refer to one another during any stage of the build process. For convenience, these three libraries are assembled into a single library by the Tango build scripts, and it is this library that is typically installed. However, it is not necessary to run a Tango application against this composite library so long as all three sub-libraries are linked in its place. Please note that the name of this composite library varies to allow it to be implicitly linked by the installed D compiler.
Here is a partial list of compilers and platforms, and the libraries they will link by default:
- DMD Win32: tango-base-dmd.lib
- DMD Linux: libtango-base-dmd.a
- GDC: libgphobos.a
Manually building Tango should produce one of the composite libraries mentioned above, plus its three component sub-libraries. Then, rather than publishing the composite library, rename the appropriate compiler runtime library to match the name of the composite library and publish that instead, accompanied by the Tango sub-library and an appropriate garbage collector sub-library. The compiler runtime library should then be linked by default, leaving the other two to be specified manually. To avoid specifying these libraries for every build, the library names may be added to the DFLAGS line for DMD or patched into the 'gdmd' script for GDC.
For example, assuming a DMD Win32 target, copy lib\compiler\tango-rt-dmd.lib to your library directory and set it as the default library instead of tango-base-dmd.lib. Then copy lib\gc\tango-gc-basic.lib and lib\common\tango-cc-tango.lib to the same location. Finally, optionally edit sc.ini to add tango-gc-basic.lib and tango-cc-tango.lib to the DFLAGS line.
While this process incurs additional maintenace issues over the default install, it offers one notable advantage: the garbage collector used by an application may be specified at link time. Also, on systems with multiple D compilers, a common Tango and garbage collector may be used, with only multiple compiler runtime libraries in place.