Platform Specific Projects#
In summary, there must be a LID file for each version of your library that needs some platform-specific code, and a platform-specific registry file that points to the appropriate LID file.
For further details of the LID file format, see LID File Format.
The library keyword remains the same across all platforms since it is, after all, a platform-dependent version of that library:
Each platform’s project may contain files that are the same in each platform, as well as files which are present in one but not in another:
Each platform’s project will probably require a different set of linked libraries. (Here we use an example from the “system” library as the “io” library doesn’t link directly against any C libraries.)
Platform-specific LID files should use the
Platformskeyword to indicate which platforms they apply to. This tells the dylan update command which registry files to create.
LID File Inheritance#
When LID files are almost identical, it can be useful to create a base LID file and inherit it, overriding whatever is necessary for each platform. A per-platform LID file might look like:
C-libraries: -framework CoreServices
For further details of setting up the registry entries, see Using Source Registries.
Normally, when a reference to a platform-independent project is placed in the
registry, it is put into the “generic” directory. Platform dependent projects
are placed in subdirectories named for the platform. For example,
opendylan/sources/registry/x86_64-linux/io points to
opendylan/sources/registry/x86-win32/io points to
The “io” library is laid out in the following manner:
All platform-specific code is inside a single module (io-internals).
*-interface.dylancontains the low-level functions accessing the platform-specific libraries (e.g.
*-file-accessor.dylanuses the functions from (2) to produce a platform-independent API (e.g.
Only those methods from (3) are exported from the module.
Most libraries that are portable aren’t as complex in
their layout as the
io library and don’t require separate