Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7736819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T07:50:25+00:00 2026-06-01T07:50:25+00:00

I want to iterate through all loaded shared libraries and get their base addresses

  • 0

I want to iterate through all loaded shared libraries and get their base addresses as well as their file names. This is basically dl_iterate_phdr on Linux.

But I want to do the same for Mac.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T07:50:27+00:00Added an answer on June 1, 2026 at 7:50 am

    The functions documented in the dyld(3) man page (which no longer seem to be online) seem to provide the analogous functionality.

    Here’s that content:

    NAME

     _dyld_image_count, _dyld_get_image_header, _dyld_get_image_vmaddr_slide,
     _dyld_get_image_name, _dyld_register_func_for_add_image,
     _dyld_register_func_for_remove_image, NSVersionOfRunTimeLibrary,
     NSVersionOfLinkTimeLibrary _NSGetExecutablePath
    

    SYNOPSIS

     #include <mach-o/dyld.h>
    
     uint32_t
     _dyld_image_count(void);
    
     const struct mach_header*
     _dyld_get_image_header(uint32_t image_index);
    
     intptr_t
     _dyld_get_image_vmaddr_slide(uint32_t image_index);
    
     const char*
     _dyld_get_image_name(uint32_t image_index);
    
     void
     _dyld_register_func_for_add_image(void (*func)(const struct mach_header* mh, intptr_t vmaddr_slide));
    
     void
     _dyld_register_func_for_remove_image(void (*func)(const struct mach_header* mh, intptr_t vmaddr_slide));
    
     int32_t
     NSVersionOfRunTimeLibrary(const char* libraryName);
    
     int32_t
     NSVersionOfLinkTimeLibrary(const char* libraryName);
    
     int
     _NSGetExecutablePath(char* buf, uint32_t* bufsize);
    

    DESCRIPTION

    These routines provide additional introspection of dyld beyond that
    provided by dlopen() and dladdr()

    _dyld_image_count() returns the current number of images mapped in
    by dyld. Note that using this count to iterate all images is not
    thread safe, because another thread may be adding or removing images
    during the iteration.

    _dyld_get_image_header() returns a pointer to the mach header of the
    image indexed by image_index. If image_index is out of range, NULL
    is returned.

    _dyld_get_image_vmaddr_slide() returns the virtural memory address
    slide amount of the image indexed by image_index. If image_index
    is out of range zero is returned.

    _dyld_get_image_name() returns the name of the image indexed by
    image_index. The C-string continues to be owned by dyld and should
    not deleted. If image_index is out of range NULL is returned.

    _dyld_register_func_for_add_image() registers the specified function
    to be called when a new image is added (a bundle or a dynamic shared
    library) to the program. When this function is first registered it is
    called for once for each image that is currently part of the process.

    _dyld_register_func_for_remove_image() registers the specified
    function to be called when an image is removed (a bundle or a dynamic
    shared library) from the process.

    NSVersionOfRunTimeLibrary() returns the current_version number of
    the currently loaded dylib specifed by the libraryName. The
    libraryName parameter would be “bar” for /path/libbar.3.dylib and
    “Foo” for /path/Foo.framework/Versions/A/Foo. This function returns
    -1 if no such library is loaded.

    NSVersionOfLinkTimeLibrary() returns the current_version number that
    the main executable was linked against at build time. The libraryName
    parameter would be “bar” for /path/libbar.3.dylib and “Foo” for
    /path/Foo.framework/Versions/A/Foo. This function returns -1 if the
    main executable did not link against the specified library.

    _NSGetExecutablePath() copies the path of the main executable into
    the buffer buf. The bufsize parameter should initially be the
    size of the buffer. This function returns 0 if the path was
    successfully copied, and
    * bufsize is left unchanged. It returns -1 if the buffer is not large enough, and * bufsize is set to the size required. Note that
    _NSGetExecutablePath() will return “a path” to the executable not a
    “real path” to the executable. That is, the path may be a symbolic
    link and not the real file. With deep directories the total bufsize
    needed could be more than MAXPATHLEN.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to iterate through all nodes in an XML file and print their
I want to iterate through all the equipment in a drawing and get the
I want to iterate through all 5 character combinations of 0-9, a-z. I worked
At my template, I want to iterate through all form errors, including the ones
I want to use foreach to iterate through all the cells in my excel
i want to iterate through variables in memory in my process (loaded through a
I want to iterate through a table/view and then kick off some process (e.g.
I want to iterate through store and make grid columns dynamically. When I use
I have written the following code in Perl. I want to iterate through a
I have a grouped UITableView with many sections, however, I want to iterate through

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.