From a44308c6ca2546b7e25479c0fe181ccdfb860029 Mon Sep 17 00:00:00 2001 From: randomdan Date: Fri, 15 Mar 2013 00:38:56 +0000 Subject: Move component loader constructor/destructors into their own unique machine generated namespace out of the way --- project2/common/scriptLoader.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/project2/common/scriptLoader.h b/project2/common/scriptLoader.h index feb958b..2582a52 100644 --- a/project2/common/scriptLoader.h +++ b/project2/common/scriptLoader.h @@ -101,11 +101,15 @@ class LoaderBase { const Glib::ustring ns; }; +#define TOKENPASTE(x, y) x ## y +#define TOKENPASTE2(x, y) TOKENPASTE(x, y) #define DECLARE_CUSTOM_COMPONENT_LOADER(N, I, T, B) \ +namespace TOKENPASTE2(I, __LINE__) { \ static void init_loader_##I() __attribute__ ((constructor(201))); \ static void init_loader_##I() { LoaderBase::newLoader(N, new T()); } \ static void kill_loader_##I() __attribute__ ((destructor(201))); \ - static void kill_loader_##I() { LoaderBase::removeLoader(N); } + static void kill_loader_##I() { LoaderBase::removeLoader(N); } \ +} #define DECLARE_CUSTOM_LOADER(N, T) \ DECLARE_CUSTOM_COMPONENT_LOADER(N, T, T, ElementLoader) #define DECLARE_COMPONENT_LOADER(N, T, B) \ -- cgit v1.2.3