Search unanswered questions...
Enter a question here...
Search: All sources Community Q&A Reference topics

Wht is static and dynamic bindings in c plus plus?

Static binding is where the linker copies the referenced module into the executable image of the program at compilation/link time. The referenced module becomes a part of the executable image.

Dynamic binding is where the linker copies only a stub code for the referenced module into the executable image. That stub code loads the referenced module into memory at load/run time.

Advantage of static is simplicity. The executable is stand-alone. Disadvantage is the executable image is larger, and if the referenced module changes, then each executable that uses it must be relinked. Another disadvantage is that if you have more than one executable using the module at the same time, you must have multiple copies of it in memory.

Advantage of dynamic is reduced size of the executable image and that changing the referenced module does not require relink of the executable. Another advantage is that most operating systems can share the referenced module, meaning that only one copy of the referenced module need exist in all of memory for any number of references to that module, such as from multiple instances of the executable. Disadvantage of dynamic is that the executable is dependent on the shared library at run time. Another disadvantage is that, since the module is shared, it must be reentrant and thread safe, and this is not always done correctly.

Improve Answer Discuss the question "Wht is static and dynamic bindings in c plus plus?" Click here to register and get updates when this answer is edited. Share on Facebook Share on Twitter

First answer by Alex146. Last edit by Alex146. Contributor trust: 96 [recommend contributor]. Question popularity: 1 [recommend question].

Answers.com > Wiki Answers > Categories > Technology > Computers > Computer Programming > C Programming > Wht is static and dynamic bindings in c plus plus?

Our contributors said this page should be displayed for the questions below. (Where do these come from)
If any of these are not a genuine rephrasing of the question, please help out and edit these alternates.
Static binding in c plus plus?  Wht do mean by static binding?  C plus plus is static or dynamic?  Define static binding in C plus plus?  S hort note on static and dynamic binding?  Static and dynamic variables in C plus plus?  What is Dynamic and Static Binding in C plus Plus?  Compare the dynamic binding of C plus plus and Java?  What is the difference between static and dynamic binding in C plus plus?