Commit e712f785 authored by Dustin L. Howett's avatar Dustin L. Howett

Wrap event registration in a static class so that it takes part in C++...

Wrap event registration in a static class so that it takes part in C++ initialization (fixes clang crash.)
parent 79e0ea65
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#include <map> #include <map>
#define _EVENT(name) void evt_ ## name (server *, struct sender *, char *); \ #define _EVENT(name) void evt_ ## name (server *, struct sender *, char *); \
static __attribute__((constructor)) void _evt_ ## name ## _init() { event_handlers[#name] = &evt_ ## name; } \ static class I_EVT_ ## name { public: I_EVT_ ##name(){ event_handlers[#name] = &evt_ ## name; } } V_EVT_ ##name; \
void evt_ ## name (server *server, struct sender *sender, char *msgbuf) void evt_ ## name (server *server, struct sender *sender, char *msgbuf)
std::map<std::string, event_handler_func> event_handlers; std::map<std::string, event_handler_func> event_handlers;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment