The starting point of plug-in technology is mainly to enable software to flexibly expand functions without the need to recompile and publish the main program (framework program). Its principle is quite simple. The functionality of the software is determined by framework programs and plug-ins. There is a specific interface between the framework program and the plug-in, through which they must pass data or control information to implement software functions. Therefore, as long as a program (or other functional entity) conforms to this interface, it is called a plug-in of the framework program.
Plug-in entities are generally divided into two types. One is a program containing logic, such as a dynamic library, Exe program, etc.; the other is a set of configuration information. The former method is mostly used in drawing software and media playback software, and is suitable for realizing complex functions; the latter method is mostly used to realize the Skin function of software and other functional modules that do not require complex calculations (there are many games). Software levels are also implemented in this way, such as Ada Software’s Lianliankan).
This article gives the framework program and usage examples for managing Dll in the process of implementing the Dll plug-in framework program, as a basis for readers to design plug-in programs. Specifically, the framework program needs to complete three functions: plug-in loading, function calling, and uninstallation.
In fact, every control panel program is a plug-in for the operating system. Because each .cpl file is a Dll that implements a specific interface. The same is true for the Windows service program, which only processes specific Windows messages based on the original program.
In fact, broadly speaking, every program running on the operating system is a "plug-in" of the operating system software.
In fact, in Delphi, there is already a plug-in management framework, which is bpl. Plug-in expansion of functions can also be easily achieved using the bpl component package. However, this method has a shortcoming: it does not support plug-in development with other development tools (such as vb, vc++).
)
Two basic classes are defined in the untDllManager unit:
TDll: The parent class of all Dll classes, providing loading and unloading related operations;
TDllManager: Container class of Dll class. Supports uninstalling Dll entities by deleting elements.
The following is a class diagram: