Cool, my motivation for creating `libwhich` in part was to be able to inspect how different systems handle dynamic libraries and this reflection method.

So seems like the main difference is just that on Ubuntu the first entry doesn't have a name, and those are explicitly skipped in my code (https://github.com/vtjnash/libwhich/blob/a11efad57d90fdb95790312d90c8f66d803125cf/libwhich.c#L200)

Indeed, the example in the Ubuntu manpage also clarifies that: "The first shared object for which output is displayed (where the name is an empty string) is the main program"

Which seems to suggest that users should just unconditionally skip the first entry if they aren't interested in the program name. Does that sound right?

-Jameson


On Mon, May 28, 2018 at 6:32 PM Bob B. <bob66@gmx.com> wrote:
> Rather than special-casing knowledge of particular systems I think the
> code should just be fixed so that it doesn't break if the main program
> is included.

I'm CC'ing the libwhich people so let them know and discuss.
For context - http://www.openwall.com/lists/musl/2018/05/28/1