DESC Overview
The DESC mechanism enables you to construct objects representing external
routines determined at execution time through their name and libraries, and
call these routines with the appropriate arguments.
Two classes, DLL_32 and
DLL_32_ROUTINE
, supported by an auxiliary class
SHARED_LIBRARY_CONSTANTS provide the basis for DESC under Windows:
- An instance of class
DLL_32 describes
a 32-bit Dynamically Linked Library. This class is a descendant of the deferred
class
SHARED_LIBRARY, covering the platform-independent notion of shared
library.
- An instance of class
DLL_32_ROUTINE
describes a routine from a 32-bit DLL. Predictably, this class has an attribute of type
DLL_32 describing the
library to which the routine belongs. It has a deferred ancestor
SHARED_LIBRARY_ROUTINE capturing the platform-independent notion of
shared library routine.
-
SHARED_LIBRARY_CONSTANTS introduces a few declarations useful for
dealing with shared libraries and routines, in particular a few integer constants
describing error codes and type codes. It is an ancestor to both of the preceding
classes; application classes using DESC can also inherit from it to gain access
to its facilities.
The basic sequence of instructions to use the DESC mechanism is the following:
- Create a library object (an instance of
DLL_32, providing the
library's name as argument to the creation procedure.
- Create a routine object (an instance of
DLL_32_ROUTINE
), providing the library object, the routine's name or index in the library, and the
routine's signature - number of arguments, types of arguments, type of result
if any - as arguments to the creation procedure.
- Apply procedure
call
to the routine object, passing an array that contains the actual arguments
required by the external routine.
Each of these steps may be repeated as often as necessary to use multiple libraries,
multiple routines in a library, or multiple calls to a given routine.