Fixed C example

This commit is contained in:
Gvidas Juknevičius 2024-06-27 23:59:31 +03:00
parent 1edaf643c9
commit 50520bb1b8
Signed by: MCorange
GPG Key ID: 12B1346D720B7FBB

View File

@ -1,6 +1,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <assert.h> #include <assert.h>
#include <string.h>
// Only use this define once, cause it defines funcitons // Only use this define once, cause it defines funcitons
#define PLUG_IMPL #define PLUG_IMPL
#include "dim_sdk.h" #include "dim_sdk.h"
@ -38,7 +39,9 @@ int plug_post_reload(void *state) {
} }
int plug_on_msg(plug_msg_t* msg) { int plug_on_msg(plug_msg_t* msg) {
if (strcmp(msg->name, "poll") == 0) {
snprintf(p->ctx.buf, BUF_SZ, "Hello from C! (%d)", p->count++); snprintf(p->ctx.buf, BUF_SZ, "Hello from C! (%d)", p->count++);
}
return 0; return 0;
} }