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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to calculate times for developing software? 8 67
Perl Awk Need Help 3 116
zeroFront challenge 7 95
EvenOdd challenge 10 105
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

813 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

13 Experts available now in Live!

Get 1:1 Help Now