Learning plug-in Architecture (i) __ architecture

Source: Internet
Author: User

Write at the beginning:

Have met several times netizens ask, plug-in in the end is how to achieve. So the germination of their learning structure in the process of learning the knowledge point to write a series of articles, so that unfamiliar users of the concept and realization of a simple understanding, but also to give themselves a training text, collation knowledge and accept everyone to correct the opportunity. Limited to their own level, the article inevitably has a lot of mistakes, welcome Daniel and all the way to correct.



Due to the different business requirements, the architecture varies widely, the author of this article belongs to remote sensing direction, therefore, the architecture is limited to the server desktop side EXE application, I hope this article for other industry friends can also help.

Plug-in definition and advantages and disadvantages I will not repeat, I believe we all know, if you do not understand can see the article: Plug-in architecture Introduction.

The original plug-in architecture originates from DLL dynamic loading, for example, I wrote a DLL that says that the DLL must export two specific functions, GetName and GetMethod, GetName to obtain the name of the DLL's contents, GetMethod to execute the corresponding code, After this exe is run, you can load all the DLL plug-ins by looking for the DLL below the specific directory. The extension can then be implemented by dynamic invocation. In short, an EXE is the equivalent of an empty frame, all executed in a DLL, and EXE loads the DLLs by the specified method and performs the appropriate work. Of course, there are a lot of episodes in the development of this framework, and we have time to look at the story:

The solution was perfect at first, and as time went on, the problem gradually came out. When a customized this set of strategies, and then one day B took over, he felt that some functional requirements in this framework can not meet the requirements, so he modified the interface, GetName passed a number of names, GetMethod can accept parameters, so, a package, release. Customer phone feedback, XXX, our previous function of the module how to use it, ah, our original EXE how can not use AH. Ah, the customer wants to be compatible with the original function, this can do is good, have to change the code recompile. What if the two are dependent on a different Third-party library? What if the system library is different? This is roughly the original DLL Hell story, Microsoft later embedded manifest probably also to solve this problem (did not verify).



Text Plug-in engineering sample program source code here: The simplest example of a plug-in framework. Everyone is welcome to take the bricks.


If there is any improper wording, please forgive me.




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.