Glossaria.net

Glossary Java / Term

dynamic linking

When functions called within a program are associated with the program at runtime rather than at compile time.


Java supports a novel paradigm for code deployment: Instead of linking the complete program into code before execution, the classes and interfaces making up the program are loaded and linked on demand during execution. Classes are verified before the creation of objects. Verification checks subtypes, and may require loading of further classes or interfaces.

This is a more complex runtime model than usually found in programming languages, but it has the advantage of faster strart-ip (as there is less code to load initially), of linking at runtime to the most up-to-date version of any utility, and of lazier error detection (exceptions only need to be thrown if there is an attempt to execute unsafe code). These advantages are obtained without compromising type safety. Usually, the Java linking process takes place implicitly, and, as long as it goes well, it does not manifest itself, and does not affect program evaluation. Thus, dynamic linking is normally transparent to Java programmers.

Nevertheless, it is not always transparent to Java programmers, even if the programmers do not use low-level features such as reflection or explicit class loading: During program execution it is possible to encounter load errors or verification errors, and, if the verifier is switched off , type safety may be violated . Therefore, it is necessary for programmers to have an understanding of this mechanism, even if they do not use it explicitly.

The Java Language Specification contains many small program examples which elucidate Java language features. Gilad Bracha, one of the authors, has stated that almost all of the Language Specification is written as if programs were compiled and linked in the conventional rather than in a dynamic manner. Dynamic linking is described only in chapter 12, Execution . This chapter, unlike most of the rest of the Specification, contains only a few examples, which demonstrate issues around initialization only. Also, although several papers formalize verification, and the overall dynamic linking process, to our knowledge, there exists no introduction in terms of examples.

https://slurp.doc.ic.ac.uk/pubs/observing/linking.html

Permanent link dynamic linking - Creation date 2022-01-03


< DTD Glossary / Java EIS >