Would a dladdr solution be more elegant and Solaris-friendly?
It might be Solaris-friendly enough since Solaris does not officially support static linking. It's probably not a bad heuristic when everything else fails. But elegant? Not by any means. It's a hack that assumes the binary is dynamically linked (which is only a valid assumption on MacOS and Solaris and only because of an arbitrary limitation enforced by the vendors), and that it has a "main" symbol - which is probably true since it's C, but _start would be a more reliable entry point, and even then it's still a convention, and... Yeah. Not going into the weeds of parsing ELF headers. It's probably good enough, and giving up if dladdr(main) fails sounds reasonable. Still, this is the kind of heuristic that has a lot of possible, obscure failure modes and that I'm in no hurry to add to skalibs, especially if its only application is to fight unnecessarily restrictive service launchers. -- Laurent
