# DVX Loader Bootstrap loader for the DVX desktop environment. Builds as `dvx.exe` -- the only native executable in the system. Everything else is a dynamically loaded DXE module. ## What It Does 1. Changes to the executable's directory so relative paths resolve 2. Calls `platformRegisterDxeExports()` to register platform functions and C runtime symbols (libc, libm, libgcc, DJGPP internals) with the DXE3 loader via `dlregsym()` 3. Recursively scans `LIBS/` for `*.lib` modules and `WIDGETS/` for `*.wgt` modules 4. Reads `.dep` files to build a dependency graph 5. Topologically sorts all modules and loads them in order with `RTLD_GLOBAL` (each module's exports become available to subsequent modules) 6. Calls `wgtRegister()` on any module that exports it (widget registration) 7. Finds `shellMain()` across all loaded modules and calls it 8. On return, closes all modules in reverse order ## Files | File | Purpose | |------|---------| | `loaderMain.c` | Entry point, directory scanning, dependency resolution, module loading | | `Makefile` | Cross-compilation rules; links `dvxPlatformDos.c` directly | The DXE export table lives in `core/platform/dvxPlatformDos.c`, not in the loader. The loader is platform-agnostic -- all DJGPP/DXE3 knowledge is in the platform layer. ## Dependency Resolution Each module may have a `.dep` file alongside it (same base name, `.dep` extension). The file lists base names of modules that must be loaded first, one per line. Lines starting with `#` are comments. Example -- `dvxshell.dep`: ``` libtasks libdvx box button label listview ``` A dependency is satisfied when either: - A module with that base name has been loaded, or - No module with that base name exists in the scan (external, assumed OK) The loader iterates until all modules are loaded or no further progress can be made (circular dependency). Unloadable modules are reported to stderr. ## Building ``` make # builds ../bin/dvx.exe make clean ``` The Makefile compiles `loaderMain.c` and links it with `dvxPlatformDos.o` (compiled from `../core/platform/dvxPlatformDos.c`) and `-lm`. The result goes through `exe2coff` + `CWSDSTUB` to produce a DOS executable.