title: How do you detect the size of a dynamic library(shared object) in the current process?
body: <p>We could use <a href="https://docs.microsoft.com/en-us/windows/win32/api/psapi/nf-psapi-getmoduleinformation" rel="nofollow noreferrer">GetModuleInformation</a> to get the information of a loaded dynamic library on Windows platforms, including its base address and size. And, <a href="https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-getmodulehandleexa" rel="nofollow noreferrer">GetModuleHandleEx</a> can take an address as the input and returns the module's handle. So basically, getting a dynamic library's base and size from an address is accessible.</p>
  <p>I don't know enough about UNIX-like platforms (including Linux, macOS, iOS, Android, etc.). How can I do the same on these platforms? <a href="https://linux.die.net/man/3/dladdr" rel="nofollow noreferrer">dladdr</a> doesn't return the size information.</p>