2,194 views
4 4 votes

Consider the following statements:

  • S1: When you statically link a file into an executable, the contents of the file are included during link time.
  • S2: When you link dynamically, it is only during run time when a pointer to the file which is linked in is included in the executable and then the contents of said file are loaded.

Which of the above statements is/are true?

1 Answer

Best answer
4 4 votes

Both correct

S1)correct because statically linking done in compile time

S2) correct, because dynamically linking done  at run time.It linked the file by pointer to heap memory and we can access heap memory at runtime only. It's only include when you later run the executable that these dynamically linked files are bought in and they're only bought into the in-memory copy of the executable, not the one on disk.

Statically-linked files are 'locked' to the executable at link time so they never change. A dynamically linked file referenced by an executable can change just by replacing the file on the disk.

http://stackoverflow.com/questions/311882/what-do-statically-linked-and-dynamically-linked-mean

selected by
Position:
Show:

Related questions

4 4 votes
1 answers 1 answer
762
762 views
Mk Utkarsh asked Nov 16, 2017
762 views
Does the dynamically linked files are slower in execution as compared to static linked files?
7 7 votes
4 answers 4 answers
3.8k
3.8k views
Akash Kumar Roy asked Mar 28, 2018
3,811 views
"Dynamic linking can cause security concerns as till run time path for searching dynamic library is not known."Can someone explain this in his own and simple words?note :...
1 1 vote
1 answers 1 answer
3.2k
3.2k views
Himanshu Goyal asked May 4, 2017
3,216 views
Can Anyone explain me the difference between Static and Dynamic links in Activation Records With some illustration or eg ?
1 1 vote
0 0 answers
506
506 views
iarnav asked Aug 25, 2018
506 views
Please explain Dynamic linking and Dynamic Libraries in an intuitive way with an example.