3 ms·
Unix was invented long before modern dynamic linking schemes were. PHK seems to think it was possible, around 1990 or before, to wave a magic wand and have all
by bitwize 5y ago
Unix was invented long before modern dynamic linking schemes were. PHK seems to think it was possible, around 1990 or before, to wave a magic wand and have all vendors agree on a way to build and link dynamic libraries. There are a number of decisions to be made before you even get there. First, which binary format -- COFF? ELF? Something else? Secondly, how do you account for the fact that the library will be loaded into different programs' memory spaces at run time? Do you:
1) insist on PIC (what Linux does)?
2) replace all pointers with dummies and fix them up at load time (what Windows does)?
3) always load a given library to the same place in virtual memory (what Linux did in the a.out days)?
Before you have a single compiler flag for dynamic library generation, you have to answer questions like this. And no single answer existed in the Unix environment of 1990, which wasn't a bazaar -- it was more like a struggle among competing cathedrals! Hence libtool, whose messiness reflects the messiness of the Unix scene at the time. GNU actually made monumental efforts to clean up the different Unixen and make them more consistent.
Fortunately, today, all widely used Unixen these days seem to have settled on ELF format and option one -- all, that is, except macOS!