Unix/Linux Go Back    


Programming Post questions about C, C++, Java, SQL, and other programming languages here.

Conditions/suggestions to use shared library in C/C++ coding

Programming


Tags
c c++, coding practices, shared library

Reply    
 
Thread Tools Search this Thread Display Modes
    #8  
Old Unix and Linux 1 Week Ago   -   Original Discussion by yifangt
Corona688's Unix or Linux Image
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 25 May 2018, 3:04 PM EDT
Location: Saskatchewan
Posts: 22,680
Thanks: 1,179
Thanked 4,324 Times in 3,987 Posts
Quote:
Originally Posted by yifangt View Post
Never tried dissection of the executable code from source code. However, this is not what I want to learn.
"What does a compiler and linker do?", and "How do executables work?" are pretty much the same question. An intimate knowledge of assembly language isn't required, though. Do you remember those old choose-your-own-adventure books? "If you say yes, go to page 37, if you say no, go to page 17", etc?

Imagine trying to write one of those. You would not write "go to page 37" in your draft - you have no idea what page 37 will be, that's your publisher's job. So you write "go to 'grisly death page'".

The publisher sets out all your pages in arbitrary order. They must make sure the beginning goes first, but otherwise the order really doesn't matter since the reader is supposed to jump around anyway. They number each page. And lastly, they change every reference to 'grisly death page' into 'page 37'.

That's exactly what a linker does, except it numbers by bytes, not pages.

If you want to add compilation to this analogy, just imagine that your publisher is Russian, and makes you send all your writing to a translator first.

Last edited by Corona688; 1 Week Ago at 12:57 PM..
Sponsored Links
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Add shared members from library to same library in a different directory kneemoe AIX 5 08-25-2012 08:21 AM
Shared library with acces to shared memory. iamjag Programming 5 06-18-2012 02:52 PM
How to change a Makefile from building static library to shared library? cpthk Shell Programming and Scripting 1 08-26-2009 02:23 AM
Suggestions/Recommendations for coding Ariean Shell Programming and Scripting 0 01-22-2009 12:05 PM
Shared memory in shared library DreamWarrior Programming 12 05-30-2007 04:33 PM



All times are GMT -4. The time now is 11:35 AM.