草庐IT

c++ - 使用共享库公开类型安全的动态 API

我正在为应用程序编写插件API接口(interface)。插件在运行时作为共享库加载。他们可以通过如下接口(interface)访问应用程序API:classIPluginAPI{public:virtualboolIsPluginsLoaded(void)=0;virtualboolIsHookingEnabled(void)=0;//Andabout50moremethods};插件可以请求“监听”某些事件(例如MouseClick、MouseScroll等)。这些功能总共构成了>300个不同的事件。通常我会做这样的事情:extern"C"voidSetEventHooks(API