A bit more info about static vs dynamic linking

Some systems support only one.
This commit is contained in:
David C W Brown 2019-10-11 17:41:45 +01:00 committed by GitHub
parent 49cb239730
commit 8cec6b3794
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -57,11 +57,13 @@ The following options designate the main module:
| Compiler option | Use |
| :-------------: | --------------------------- |
| ```-m``` | Generate loadable binary using dynamic library loading (on systems that support it). |
| ```-M``` | Generate loadable binary with all library references statically linked. |
| ```-m``` | Generate loadable binary using dynamic library loading (*see note*) |
| ```-M``` | Generate loadable binary with all library references statically linked (*see note*) |
For a main module, no .sym or .h files are generated, and the C compiler is called with additional parameters to generate the execututable binary, linking the object files needed for imported modules.
*Note:* not all systems support both static and dynamic linking: some support only static; some support only dynamic. When a system only supports one, ```-m``` and ```-M``` behave the same.
### Separate compilation
Each module may be compiled by a separate command line, although the imports of a module must be compiled before the module is compiled. All three generated files (.sym, .c and .h) must be retained at least until all modules dependent on this module have been compiled.