How do plugin systems work?

后端 未结 4 2069
半阙折子戏
半阙折子戏 2020-12-18 06:45

I\'m working on a project where I would find a basic plugin system useful. Essentially, I create the base class and can provide this base class to a plugin developer. Then t

4条回答
  •  臣服心动
    2020-12-18 07:33

    Probably almost the only documentation you'll be able to find will be of existing systems.

    Basically, you have two common types of plug-ins. One handles things like translations to/from some foreign file type. In this case, you typically have about three functions: one to recognize the file format, one to read and one to write it. Along with those, you'll typically have a few strings to specify a file extension.

    Another possibility is something that does processing inside your program. In this case, it'll typically specify some entries to be added to your menu structure and a function to be invoked for each. In most cases you'll have at least one other function to do something with serializing its current configuration. From there it'll be up to you to decide how to expose enough of the internals of your program for it to be able to do something useful.

提交回复
热议问题