Type library

from Wikipedia, the free encyclopedia

A type library (Engl .: type library ) for the purposes of electronic data processing is a standardized communication key (an interface description ) for access to the public data structures and subroutines of a foreign utility ( server ) that so by many other programs ( clients are shared) anonymous can. Examples of the use of type libraries can be found in COM , dynamic runtime libraries and the metadata descriptions of modern runtime systems such as Java (programming language) or .NET .

implementation

In the case of a procedural implementation , the published resources are functions or methods . Using an algorithm , they determine one or more determined result values ​​from the input values ​​transferred to them and return them to the calling program.

In the case of an object-oriented implementation, complex structured data classes are defined in the service program (server) . These data classes serve as templates for certain data objects that can be created, saved, recalled and deleted locally according to this template at runtime. The complex properties of valid (that is, generated and stored, i.e. " instantiated ") data objects can be read and changed with the help of the methods implemented in the service program (server) . These methods use internal procedural functions that can be both public and hidden. The server does not have to offer all methods of the class to a client in its interface. For shared use by external programs, however, at least the methods for generating and destroying these data objects ( constructors and destructors ), a subset of their properties and a subset of their existing manipulation methods must be public.

Creation of the type library

Access to the functions and data objects of the service program (server) can be regulated by a lock, the so-called dispatch interface (in German, to a certain extent, “courier interface”). This "courier" in the service program (server) receives requests from the outside world. As long as they are formulated in an understandable and valid manner, it internally calls the appropriate subroutines and returns the results obtained.

The type library as an interface description defines the language rules for data communication with the server on the part of the calling program (client). It allows the calling program to formulate call commands in a predefined, understandable syntax ( calling convention ) and to correctly assign and evaluate the feedback and results. It enables regulated access to the programmatically outsourced, but publicly accessible data structures and functions of the service program (server).

Type libraries are created as a programming interface according to generalized conventions, catalog-like, schematically and machine-readable (see: Component Object Model / COM). This methodology enables the flexible linking of numerous specialized program modules, which can also be distributed on different computers with different operating systems or different programming languages , to form complex applications (see also: Distributed Systems ).

A type library can be an independent, typed interface file (e.g. .TLB file for COM) , it can be contained as metadata in the server ( Java or .NET ), or it can be integrated into the calling program (client).

use

The calling program (client) initially forwards a command to its own runtime system, which has been translated into a form understandable for the service program (server) with the help of the type library . This calls the docked program component (server) either directly or indirectly and returns its feedback and results in its own syntax to the calling program (client).

The service program (server) can be called directly if both parts of the program are executed on the same computer and under the same operating system or even within the same process . The situation is different in a distributed system in which the service program (server) is addressed indirectly via a network on another network computer. This can be a real or virtual network computer with the same or a different operating system.

Data objects in the called program module (server) must first be generated by the calling main program (client) during runtime using the server commands provided for this purpose as independent "instances" of their respective class definition, since the server cannot access the address space of the client (see Serialization , distributed system ).

As a rule, the called up program component (server) does not communicate independently with the user, but only provides an anonymous service. Your own user interface, if any, remains hidden from the user.