2020-08-07 14:29:06 +02:00
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
|
|
#include <map>
|
2020-08-12 16:43:44 +02:00
|
|
|
#include <json.hpp>
|
2020-08-07 14:29:06 +02:00
|
|
|
|
2020-09-20 00:19:39 +02:00
|
|
|
#ifdef _WIN32
|
|
|
|
#ifdef SDRPP_IS_CORE
|
|
|
|
#define SDRPP_EXPORT extern "C" __declspec(dllexport)
|
|
|
|
#else
|
|
|
|
#define SDRPP_EXPORT extern "C" __declspec(dllimport)
|
|
|
|
#endif
|
|
|
|
#else
|
2020-09-20 00:26:45 +02:00
|
|
|
#define SDRPP_EXPORT extern
|
2020-09-20 00:19:39 +02:00
|
|
|
#endif
|
|
|
|
|
2020-08-07 14:29:06 +02:00
|
|
|
#ifdef _WIN32
|
|
|
|
#include <Windows.h>
|
2020-09-20 00:19:39 +02:00
|
|
|
#define MOD_EXPORT extern "C" __declspec(dllexport)
|
2020-08-07 14:29:06 +02:00
|
|
|
#else
|
2020-08-11 18:33:42 +02:00
|
|
|
#include <dlfcn.h>
|
2020-09-20 00:19:39 +02:00
|
|
|
#define MOD_EXPORT extern "C"
|
2020-08-07 14:29:06 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
namespace mod {
|
|
|
|
|
|
|
|
struct Module_t {
|
|
|
|
#ifdef _WIN32
|
|
|
|
HINSTANCE inst;
|
|
|
|
#else
|
|
|
|
void* inst;
|
|
|
|
#endif
|
2020-10-01 01:21:15 +02:00
|
|
|
void (*_INIT_)();
|
2020-10-01 13:46:12 +02:00
|
|
|
void* (*_CREATE_INSTANCE_)(std::string name);
|
|
|
|
void (*_DELETE_INSTANCE_)(void* instance);
|
2020-10-01 01:21:15 +02:00
|
|
|
void (*_STOP_)();
|
2020-08-07 14:29:06 +02:00
|
|
|
void* ctx;
|
|
|
|
};
|
|
|
|
|
2020-10-01 01:21:15 +02:00
|
|
|
struct ModuleInfo_t {
|
2020-10-01 13:46:12 +02:00
|
|
|
const char* name;
|
|
|
|
const char* description;
|
|
|
|
const char* author;
|
|
|
|
const char* version;
|
2020-10-01 01:21:15 +02:00
|
|
|
};
|
|
|
|
|
2020-08-07 14:29:06 +02:00
|
|
|
void loadModule(std::string path, std::string name);
|
2020-08-12 16:43:44 +02:00
|
|
|
void loadFromList(std::string path);
|
2020-10-01 13:46:12 +02:00
|
|
|
bool isLoaded(void* handle);
|
2020-08-07 14:29:06 +02:00
|
|
|
|
|
|
|
extern std::map<std::string, Module_t> modules;
|
|
|
|
extern std::vector<std::string> moduleNames;
|
2020-08-11 18:33:42 +02:00
|
|
|
};
|
|
|
|
|
2020-10-01 01:21:15 +02:00
|
|
|
#define MOD_INFO MOD_EXPORT const mod::ModuleInfo_t _INFO
|