A `ctypes` function to list all loaded shared libraries

For what it’s worth, I was also looking for this functionality recently, didn’t find it in the standard library and had to figure it out myself. It would be helpful to have it provided as part of ctypes.util.

I didn’t know about dl_iterate_phdr and instead resorted to reading /proc/self/maps on Linux, so thanks for the tip.

@WardBrian I could probably help with some basic testing on FreeBSD. And there’s a FreeBSD builder in the CI as well. According to the dl_iterate_phdr man page, it’s been available on FreeBSD since version 7.0, so that should presumably work.

1 Like