dlopen-demo/inc/plugin.hpp

26 lines
523 B
C++
Raw Permalink Normal View History

#pragma once
#include <string>
static char* plugin_error;
// define a schema for plugins
class Plugin {
private:
const char* name;
void* handle;
void* (*fn_init)();
int (*fn_call)(void*, int argc, char* argv[]);
int (*fn_exit)(void*);
void* data;
// Constructor
void init (char* so_path);
public:
Plugin (char* path);
Plugin (std::string path);
Plugin (Plugin&&) = default;
~Plugin ();
int call (int argc, char* argv[]);
int operator()(int argc, char* argv[]);
};