From d19e4a4e363e6e0aebbd3df3535dbdbe4b857acd Mon Sep 17 00:00:00 2001 From: KiritoDv Date: Thu, 8 Jan 2026 22:43:24 -0600 Subject: [PATCH] Fixed compilation error in a better way --- src/port/hooks/Events.h | 8 -------- src/port/hooks/impl/EventSystem.h | 10 ++++++++++ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/port/hooks/Events.h b/src/port/hooks/Events.h index 37646b33..0d70be1a 100644 --- a/src/port/hooks/Events.h +++ b/src/port/hooks/Events.h @@ -1,12 +1,4 @@ #pragma once -#ifdef __cplusplus -extern "C" { -#endif - #include "list/EngineEvent.h" #include "list/PlayerEvent.h" - -#ifdef __cplusplus -} -#endif \ No newline at end of file diff --git a/src/port/hooks/impl/EventSystem.h b/src/port/hooks/impl/EventSystem.h index 7b97938d..9fbc00d0 100644 --- a/src/port/hooks/impl/EventSystem.h +++ b/src/port/hooks/impl/EventSystem.h @@ -24,6 +24,7 @@ typedef struct { EventCallback function; } EventListener; +#ifndef __cplusplus #ifdef INIT_EVENT_IDS #define DECLARE_EVENT(eventName) \ uint32_t eventName##ID = -1; @@ -31,6 +32,15 @@ typedef struct { #define DECLARE_EVENT(eventName) \ extern uint32_t eventName##ID; #endif +#else +#ifdef INIT_EVENT_IDS +#define DECLARE_EVENT(eventName) \ + extern "C" uint32_t eventName##ID = -1; +#else +#define DECLARE_EVENT(eventName) \ + extern "C" uint32_t eventName##ID; +#endif +#endif #define DEFINE_EVENT(eventName, ...) \ typedef struct { \