From 50520bb1b87ba1c8f1533e44a59f9e172248958a Mon Sep 17 00:00:00 2001 From: MCorange Date: Thu, 27 Jun 2024 23:59:31 +0300 Subject: [PATCH] Fixed C example --- dim_plugins/example_c/src/main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dim_plugins/example_c/src/main.c b/dim_plugins/example_c/src/main.c index a45ca4d..9653598 100644 --- a/dim_plugins/example_c/src/main.c +++ b/dim_plugins/example_c/src/main.c @@ -1,6 +1,7 @@ #include #include #include +#include // Only use this define once, cause it defines funcitons #define PLUG_IMPL #include "dim_sdk.h" @@ -38,7 +39,9 @@ int plug_post_reload(void *state) { } int plug_on_msg(plug_msg_t* msg) { - snprintf(p->ctx.buf, BUF_SZ, "Hello from C! (%d)", p->count++); + if (strcmp(msg->name, "poll") == 0) { + snprintf(p->ctx.buf, BUF_SZ, "Hello from C! (%d)", p->count++); + } return 0; }