Search code examples
xcodelinkerld

Understand xcode linking (ld)


After running into linker errors one time too many, I have come to the conclusion that I really need to understand how ld works, rather than just asking SO for black magic fixes everytime something doesn't work. I've found the Mac OS ld man pages which do provide some information, but as they say, they are intended for people who already understand ld. How can one gain that understanding?

Part of the problem is that there are different flavors of ld -- unix and gcc at a minimum -- and does clang have its own flavor? So I'm not sure what docs apply.


Solution

  • Here's a great tutorial about linkers:
    Beginner's Guide to Linkers

    It's very technical stuff, of course, but very well explained. I don't think you still will see «black magic», as you say, after reading it.