Typically you'll want to build with the pre-compiled library procedures. If you are developing a library you will want to import and build the source code for any library procedures you use. In both cases you just give the name of the library on the Import declaration.
A program accesses a library by importing one of two primary classes. If you tell to compiler to link with the library file then it will import the public class. Otherwise, the class that brings in source code will be imported and library procedures will be built as well.
The public class file ends in ".public.clg" and the source code class file ends in ".clg" only. Also when you compile using the the library source class as the primary file then it will create the library file.
My.Program.clg: import My.Library Build project file: my.program.clg Link: my.library.lib my.library.pdb Imports: my.library.public.clg and my.library.public.cmg Produces: my.program.exe Build project file: My.Program.clg Imports: My.Library.clg and My.Library.cmg Produces: my.program.exe Build project file: my.library.clg Imports: My.Library.clg and My.Library.cmg Produces: my.library.lib and my.library.pdb
The top level directory for a library typically contains:
<Library>.clg Primary class to access the library source code <Library>.cmg Corresponding source code map file <Library>.public.clg Public class with signatures to call library procedures <Library>.public.cmg Corresponding public map file <Library>.lib Generated binary file for programs to link in <Library>.pdb Corresponding Program Database file used for debugging
The primary class for a library designates a names space for the library. The Public clauses lists a prefix that is prepended to the names of classes, procedures, types, and global variables. Except to disambiguate occasional name collisions, the prefix is not needed to qualify names.
Not every class and procedure in a library needs to be imported by the primary class. Only items in the library that always get used need to be imported at the top level. To get the optional items an additional import will be needed to access them. For example, the Gilda.Basis library initially imports only essential components. To get optional components such as Math.Integer, that needs to be imported explicitly. The primary class should import any essential classes and types.
Generics require sources.
The primary map file should declare paths for all classes visible to the library patrons. Library classes must be located in directories below the primary directory.
The primary Public class declares any essential types and imports other public classes. The body contains procedure signatures for essential procedures. Optional procedure signatures are declared in the optional public classes.
Map all the public classes.