Chapter 30 The dynlink library: dynamic loading and linking of object files
The dynlink library supports type-safe dynamic loading and linkingof bytecode object files (.cmo and .cma files) in a runningbytecode program, or of native plugins (usually .cmxs files) in arunning native program. Type safety is ensured by limiting the set ofmodules from the running program that the loaded object file canaccess, and checking that the running program and the loaded objectfile have been compiled against the same interfaces for these modules.In native code, there are also some compatibility checks on theimplementations (to avoid errors with cross-module optimizations); itmight be useful to hide .cmx files when building native plugins sothat they remain independent of the implementation of modules in themain program.
Programs that use the dynlink library simply need to linkdynlink.cma or dynlink.cmxa with their object files and other libraries.