2024-06-14 15:22:20 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <assert.h>
|
|
|
|
|
2024-06-15 21:59:04 +00:00
|
|
|
#include "dim_sdk.h"
|
2024-06-14 15:22:20 +00:00
|
|
|
|
2024-06-15 21:59:04 +00:00
|
|
|
PLUG_INFO("Example plugin", "0.0.1", "GPLv3")
|
2024-06-14 15:22:20 +00:00
|
|
|
|
|
|
|
typedef struct plug_t {
|
|
|
|
char* some_data;
|
|
|
|
int count;
|
|
|
|
} plug_t;
|
|
|
|
|
|
|
|
plug_t* p = {0};
|
|
|
|
|
|
|
|
void plug_init() {
|
|
|
|
p = malloc(sizeof(plug_t));
|
|
|
|
assert(p != NULL && "Buy more ram KEKW");
|
|
|
|
p->count = 0;
|
|
|
|
|
|
|
|
printf("Hello from plugin");
|
|
|
|
}
|
|
|
|
|
|
|
|
void* plug_pre_reload() {
|
|
|
|
return p;
|
|
|
|
}
|
|
|
|
|
|
|
|
void plug_post_reload(void *state) {
|
|
|
|
p = state;
|
|
|
|
}
|
|
|
|
|
|
|
|
void plug_poll(char *buf, size_t len) {
|
2024-06-15 21:59:04 +00:00
|
|
|
snprintf(buf, len, "Hello from C! (%d)", p->count++);
|
2024-06-14 15:22:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void plug_free() {
|
|
|
|
free(p);
|
|
|
|
}
|