Unix Make ar and ld

Posted on 2003-12-11
Last Modified: 2013-12-26
What do ar and ld exactly do in making a library? Are these diiferent programs for the same purpose or are they used in tandem for file archiving. Can anybody point me to some links. I heard that the order of the libraries matters in ar and does not in ld. can somebody elaborate.

Question by:supavan

Accepted Solution

HamdyHassan earned 25 total points
ID: 9923940

do the following
$ man ar
$ man ld

check "Creating Unix Libraries" at

From this article, you could see "ar" is used for "Static Libraries" and "ld" is used for "Dynamic libraries"

LVL 51

Assisted Solution

ahoffmann earned 25 total points
ID: 9930977
.. completing HamdyHassan comment:
ar - maintain portable archive or library
simply maintains a group of (.o) files in an archive.
When building executable from object files or archives, the order is important.

ld - link-editor for object files
is either used to build (dynamic) hared objects, which either is a (dynamic) shared library, or an executable.
For these objects the oder is not important as long as there are no cyclic references and no other static objects.
For details see corresponding man pages
LVL 18

Expert Comment

ID: 10241422
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Points split HamdyHassan & ahoffmann

Please leave any comments here within the next seven days.


EE Cleanup Volunteer

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Question regarding Copy/Paste 16 86
Adapt this command to show who installed 29 102
Separate into files by filename 12 67
Line meaning 9 77
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now