#include "com_excute.hpp" ComExcute com_excute; ComExcute::config::config(const char *name, handle_t handle) { this->name = name; this->handle = handle; com_excute.add_excute(*this); } ComExcute::config::~config() {} int ComExcute::add_excute(ComExcute::config config) { com_excute.configs.push_back(config); return 0; } void com_excute_init() { for (int i = 0; i < com_excute.configs.size(); i++) { ComExcute::config config = com_excute.configs[i]; std::cout << "load handle: " << config.name.toStdString() << std::endl; } } void excute_handle(QString data, unsigned int len) { for (int i = 0; i < com_excute.configs.size(); i++) { ComExcute::config config = com_excute.configs[i]; if (config.name == data) { config.handle(nullptr); break; } } } void hello_world(void *p) { std::cout << "Hello World!" << std::endl; } EXPORT_HANDLE(hello_world);