3 ms·
Among other things, because the ways to bind to a dynamic symbol are multitudinous and frequently painful. For example, IIRC, ELF dynamic linking occasionally
by mananaysiempre 5y ago
Among other things, because the ways to bind to a dynamic symbol are multitudinous and frequently painful.
For example, IIRC, ELF dynamic linking occasionally forces the compiler and/or linker through spectacular contortions in order to ensure two pointers to a single function compare equal (as required by the C standard and as happens with static libraries) even if the values being compared originate from two different shared objects, the function itself resides in a third one, and the compiler has no idea which functions are external to the shared object its output will be linked into.
(Windows tells the standard to go take a hike, or more charitably doesn’t attempt to badly emulate the semantics of static linking in dynamic linking. I’m actually with Windows here, even if their executable format is a horrible underdocumented mess.)
Those contortions are not required when the function is only ever called and never has its address taken, except compilers can be pretty naive about that part. Not that they have to be, but at least it’s not an obvious sure thing.