diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/CommonAPI/Types.hpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/CommonAPI/Types.hpp b/include/CommonAPI/Types.hpp index 6f6801d..4cdff5d 100644 --- a/include/CommonAPI/Types.hpp +++ b/include/CommonAPI/Types.hpp @@ -53,11 +53,21 @@ namespace CommonAPI { static void __cdecl f(void); \ __declspec(allocate(".CRT$XCU")) void(__cdecl*f##_)(void) = f; \ static void __cdecl f(void) +#define DEINITIALIZER(f) \ + static void __cdecl f(void); \ + static void _##f##_wrapper(void) { \ + atexit(f); \ + } \ + __declspec(allocate(".CRT$XCU")) void(__cdecl * f##_)(void) = _##f##_wrapper; \ + static void __cdecl f(void) #else #define CCALL #define INITIALIZER(f) \ static void f(void) __attribute__((constructor)); \ static void f(void) +#define DEINITIALIZER(f) \ + static void f(void) __attribute__((destructor)); \ + static void f(void) #endif namespace CommonAPI { |