3 ms·
How does it work on mac? Do you have to specify the full path of the library to load it?
by gruez 6y ago
How does it work on mac? Do you have to specify the full path of the library to load it?
- deleted 6y ago[deleted]
- ratww 6y agoIn practice it's transparent, like using a static library. The linker handles it all for you during compilation: it stores the paths at a special section in your executable, and a injects a dynamic linker in your code. The paths can be either absolute (for system libs) or relative (useful for distributing Bundled apps). The cool thing is that you can see those hardcoded paths using otool -L and you can modify them using install_name_tool. Useful for debugging misbehaving closed-source tools.
- saagarjha 6y agodyld, the dynamic linker on macOS, handles it for you. You tell it what you need it will handle mapping in the correct pages for you from the big file; both statically (based on your binary's load commands) and dynamically (using dlopen, etc.) The process is essentially transparent unless you look really carefully at what it's doing under the hood.