SDRPlusPlus/core/src/module.h

54 wiersze
1.1 KiB
C
Czysty Zwykły widok Historia

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