denis631
denis631

Reputation: 1865

Does OS X have two linkers ? One static and one dynamic?

The problem is, I've found out that Mac OS X has an dyld (as I understood a dynamic linker) but also a simple linker ld (as I understood a static one).

The question is: Is it really so ? Two linkers? One static and one dynamic ?

Why they've decided to have two ? Linux has only one linker (ld) which does both static and dynamic linking.

Upvotes: 7

Views: 945

Answers (1)

Ken Thomases
Ken Thomases

Reputation: 90551

You have misunderstood the meaning of "linking". Or, thought of another way, you haven't realized it has two meanings.

If it helps, think of dyld as the dynamic loader rather than "linker". dyld is the program which loads the dynamic libraries referenced by an executable into the process's address space. It still involves linking because it requires the resolution of symbol references.

You never invoke dyld as part of a build procedure. You always use ld or, more typically, you ask the compiler to link your program and it invokes ld on your behalf. dyld is only used at run time.

You're incorrect when you assert that Linux doesn't have this distinction. Linux has a dynamic loader, ld.so, which is distinct from the static linker, ld.

Upvotes: 7

Related Questions