dim/sdk/c_cxx/dim_sdk.h
2024-06-20 23:43:16 +03:00

36 lines
1.0 KiB
C

#ifndef _H_PLUG
#define _H_PLUG
#include <stdio.h>
typedef struct plug_info_t {
char* name;
char* version;
char* license;
} plug_info_t;
typedef struct plug_ctx_t {
char* config_dir;
} plug_ctx_t;
#define PLUG_INFO(_name, _version, _license) \
static plug_info_t PLUG_INFO_VAR = { .name=(_name), .version=(_version), .license=(_license)}; \
void* plug_get_info() { \
return &PLUG_INFO_VAR; \
}
#define PLUG_NAME(s) volatile char* PLUG_NAME = (s);
#define PLUG_VERSION(s) volatile char* PLUG_VERSION = (s);
#define PLUG_LICENSE(s) volatile char* PLUG_LICENSE = (s);
void plug_init(plug_ctx_t*); // Loads when DIM initialises
void* plug_pre_reload(); // Return a pointer to save state
void plug_post_reload(void*); // returns the same pointer after reload
void plug_poll(char*, size_t); // Write the message to `buf` with max `size` characters
void plug_free(); // Free everything before being killed
#endif