SDRPlusPlus/core/src/module.h

62 wiersze
1.3 KiB
C
Czysty Zwykły widok Historia

2020-08-07 12:29:06 +00:00
#pragma once
#include <string>
#include <map>
#include <filesystem>
#include <stdint.h>
#include <imgui.h>
#include <spdlog/spdlog.h>
2020-08-11 16:33:42 +00:00
#include <dsp/types.h>
#include <dsp/stream.h>
2020-09-19 22:19:39 +00:00
#include <gui/waterfall.h>
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_)();
void* (*_CREATE_INSTANCE)(std::string);
void (*_DELETE_INSTANCE)();
void (*_STOP_)();
2020-08-07 12:29:06 +00:00
void* ctx;
};
2020-09-30 23:21:15 +00:00
struct ModuleInfo_t {
char* name;
char* description;
char* author;
char* version;
};
2020-08-12 14:43:44 +00:00
void initAPI(ImGui::WaterFall* wtf);
2020-08-07 12:29:06 +00:00
void loadModule(std::string path, std::string name);
2020-08-11 16:33:42 +00:00
void broadcastEvent(int eventId);
2020-08-12 14:43:44 +00:00
void loadFromList(std::string path);
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