37 lines
609 B
C
37 lines
609 B
C
#include <stdlib.h>
|
|
#include <assert.h>
|
|
|
|
typedef struct plug_t {
|
|
char* name; // Always keep these on top
|
|
char* version;
|
|
} plug_t;
|
|
|
|
|
|
static plug_t* p = {0};
|
|
|
|
|
|
void* plug_init(void) {
|
|
p = malloc(sizeof(plug_t));
|
|
assert(p);
|
|
p->name = "example";
|
|
p->version = "0.0.1";
|
|
// Return NULL if error
|
|
return p;
|
|
}
|
|
|
|
void* plug_pre_reload(void) {
|
|
return p; // send state to dim
|
|
}
|
|
|
|
void plug_post_reload(void* pp) {
|
|
p = pp; // get back state
|
|
}
|
|
|
|
void plug_poll(char* buf, size_t len) {
|
|
// print text to `buf` with max len `len`
|
|
}
|
|
|
|
void plug_free(void) {
|
|
free(p); // free state
|
|
}
|