Elements of the C/C ++ plug-in development framework
First, solve the following problems:
1. Register a plug-in;
2. How to call the plug-in;
3. How to test the plug-in;
4. lifecycle management of plug-ins;
5. Management and Maintenance of plug-ins;
6. Plug-in assembly;
7. Agent error handling;
8. Broadcast and subscribe to service events (this is not yet considered for support );
Among them, there are several important points: 1) the plug-in framework should be able to make the modules loosely coupled for real interface-oriented programming; 2) the framework should support automated testing, including unit testing and integration testing; 3) Simplified deployment; 4) Support for distributed deployment. modules can call plug-ins outside the framework.
Technologies used
One problem to be solved by the plug-in framework is the dynamic loading capability of the plug-in. The dynamic loading technology of shared libraries can be used here. Of course, for simplicity, the first step is to consider only a plug-in framework under linux.
Overall Structure
For the overall structure of the Framework, refer to the OSGI "microkernel + system plug-in + application plug-in" structure. Here, we should consider what to do in the kernel. With regard to the microkernel structure, I used to create a microkernel process engine and will share it with you later.
There are two solutions for inter-module data transmission in the framework: first, the XML data bus approach adopted by panyuan. The advantage is good scalability and readability. However, the speed is slow. The second is to use cell streams that I am familiar. The advantage is high efficiency, convenient access, but less readable. In addition, the network byte sequence needs to be considered for cross-framework data transmission.
For inter-framework communication, the system plug-in is encapsulated to hide the communication details of the application plug-in.
Deployment
One-click deployment.