Package dependency is handled before loading the target module or package. Just before opening the requested dynamic library, gpmi will look for a file called libname.dep in the same dir, so module dependency files are collected in the module dir and package dependency files are in the packages dir.
The file contains a white-space separated list of package names that should be loaded before the actual library is loaded. Required version optionally may be specified using a ':' character and an integer immediately after the package name. Dependency files are checked recursively in any depth.
User has to remember to copy the dependency file with a precompiled package or module - loading such a library would fail without having the dependency file.
Applications may have a dependency file too. It must be in the same dir as the application binary is, and must be called "gpmi.dep". This file will be loaded on gpmi_init() so packages referenced here are preloaded before any other package or module.
Finally, here is the grammar:
dependency_list: /* empty */ | dependency_list [whitespace]* dependency ; dependency: library_name | library_name ':' version ; library_name: [alnum]* ; version: [number]* ;