5 ms·
>> I'm no kernel hacker, but doesn't that make the GP argument better? Nope. Dynamic linking is done each time the program is loaded - the kernel calls out to
by nteon 13y ago
>> I'm no kernel hacker, but doesn't that make the GP argument better?
Nope. Dynamic linking is done each time the program is loaded - the kernel calls out to the dynamic linker to open shared libraries, resolve symbols, create jump tables & the like. Static linking is done once (at compile/link time). When you execute a statically compiled library, the kernel just loads the text, data & bss into memory and more or less starts executing main(). Much, much simpler, although you lose the ability to do things like ASLR.
- BugBrother 13y agoMy point was that with dynamic libraries at fixed memory addresses, dynamic linking information can be cached (as long as no binaries are updated). That would imply similar efficiency as for static libraries. Sorry if I wasn't clear.
- lmz 13y agoIsn't that what prelinking[1] does? [1]: http://en.wikipedia.org/wiki/Prelink http://en.wikipedia.org/wiki/Prelink
- BugBrother 13y agoThanks. He, a bit after I stopped doing "real" work and went scripting. :-) :-( Sometimes I regret that, but then I think of the repeated reading of the Effective C++ books. Not to mention the writing of C for a week which I could throw together in hours in Lisp or Perl.
- ithkuil 13y agofurthermore the most dramatic issues arise with C++ vtables, although even that has been addressed with prelinking and a large address space helps a lot.
- ChuckMcM 13y agoBugBrother however correctly interpreted my suggestion, which is that given a large address space, one could define an address where shared libraries would always appear. Thus your linking information can be fixed in in the executable and the only dynamic part is a check to see if the library is loaded or not. Thus all the link speed benefits of static linking, the load speed benefits of dynamic linking.