Learn how to a build a cloud-first strategyRegister Now


ld linker script INPUT(-lfile)

Posted on 2009-04-30
Medium Priority
Last Modified: 2012-06-27
hi all ,
I just reading the documents about the how to write linker scripts ,

and the INPUT command explains like this

>>If you use INPUT (-lfile), ld will transform the name to libfile.a, as with the command line argument -l.

>>When you use the INPUT command in an implicit linker script, the files will be included in the >>link at the point at which the linker script file is included. This can affect archive searching.

what is the difference of the libfile.a and file.o ?

is that .a means that static library file ? what is that command line options ?

-- Thanks in advance --
Question by:NicAx64
  • 3
  • 2
LVL 86

Expert Comment

ID: 24272336
>>what is the difference of the libfile.a and file.o ?

libfile.a is a static library created with 'ar', e.g. like

ar -cr libfile.a libfile.o

(creates libfile.a from file.o)

whereas file.o is just an object file created during the compilation proces, which can either be linked to an executable image via 'ld' or archived in a lib using 'ar' as above.
LVL 86

Accepted Solution

jkr earned 2000 total points
ID: 24272352

Author Comment

ID: 24272378
excellent sir ,
that's meet the answer to the question, however if you got something to read please let me know.
I'm currently reading this ,


Author Closing Comment

ID: 31576552
nice work
thanks in advance ,
I'm reading you'r man pages.
LVL 86

Expert Comment

ID: 24272408
Hm, I guess http://www.faqs.org/docs/Linux-HOWTO/Program-Library-HOWTO.html would be some good material on this issue, as well as the other HOWTOs listed under http://www.tldp.org/HOWTO/HOWTO-INDEX/programming.html

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses
Course of the Month21 days, 1 hour left to enroll

810 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