What are similarities and differences between dynamic loading and late binding?

what are similarities and differences between dynamic loading and late binding?

  • From wikipedia: Dynamic loading is a mechanism by which a computer program can, at run time, load a library (or other binary) into memory, retrieve the addresses of functions and variables contained in the library, execute those functions or access those variables, and unload the library from memory. Late binding is a computer programming mechanism in which the method being called upon an object is looked up by name at run-time. In my opinion, A similarity is they are both mechanisms in which methods are looked up at run-time. A difference is dynamic loading does not need to use a linker after loading the library at run-time but late binding always need a linker. I'm not sure if I am correct, especially the difference part. I would like to learn more from your analysis.

  • Answer:

    Late binding, much like overcommit, is a hack to squeeze out some extra benefit (performance / memory allowance) at the expense of correctness and possible late catastrophic failure. Without late binding, dynamic loading of modules will succeed only if all symbols needed for relocation can be resolved at load time, and you get a meaningful error from which you can recover if they can't be resolved. With late binding, dynamic loading virtually always "succeeds", then can crash your program later when the dynamic loaded module tries to reference a symbol that can't be resolved.

tsubasa at Stack Overflow Visit the source

Was this solution helpful to you?

Other answers

As I understand it, dynamic loading is a lower level than late binding. So a late bound function call looks and feels just like an ordinary function call, except that if the library is missing then the application will terminate when the call is attempted instead of when the application launches, while for dynamic loading you have to write more code but you get to do error handling, such as calling a fallback method.

Neil

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.