|
|
|
|
|
by aidanhs
1673 days ago
|
|
This is missing a lot of detail around libc (can't comment on the others), but was published ~1.5 years after musl was first released - I can imagine the subtleties being missed in a glibc monoculture. To expand a bit: 1. dlopen has interactions with static linking that you should understand if you use both at the same time. Different libcs expose different symbols for libc functions, so building your dynamic library against one libc may make it incompatible with another. And two libcs in the same program (one from the dylib, one from the binary) is a recipe for a very bad time - imagine freeing a pointer allocated with a different malloc implementation, or a different layout of libc structs 2. the complexity with glibc is it invokes dlopen as part of NSS, a feature that gets used as part of looking up users, among other things (it does this to allow integration with LDAP etc). You can actually see warnings at link time if you statically link glibc but pull in symbols that use NSS. You can disable NSS if you like at build time of glibc itself [0] (i.e. not your binary) 3. musl doesn't have the complexities of NSS and can be statically linked happily by default (I suspect that's probably what musl is most used for) [0] https://sourceware.org/glibc/wiki/FAQ#Even_statically_linked... |
|
Depends on the exact architecture of the program, y'know. I remember a Windows app written in Delphi (so no libc whatever) that supported loading plugins written it whatever; and I've seen it load simultaneously plugins that linked against msvcrt90.dll and msvcrt100.dll with no problem. But that worked because plugins were required to export a FreeObject function that is supposed to be used to free whatever structures a plugin returned from its other functions. The main program tracked what piece of data came from where and called proper deallocation functions.
But that requires acknowledgement of a fact that there is no "single, global C runtime".