aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authormwturvey <michael.w.turvey@intel.com>2017-03-16 10:32:18 -0700
committermwturvey <michael.w.turvey@intel.com>2017-03-16 10:32:18 -0700
commit27c9edd889c746e818dc3aa55971d9cd6d8595a7 (patch)
tree7b38a03436bf11dfab7b0c3145ca9f1560374115 /include
parentfa0f4825937ed93163bb2cd165c001d7444d8928 (diff)
downloadlibsurvive-27c9edd889c746e818dc3aa55971d9cd6d8595a7.tar.gz
libsurvive-27c9edd889c746e818dc3aa55971d9cd6d8595a7.tar.bz2
Manual registration on Windows
Diffstat (limited to 'include')
-rw-r--r--include/libsurvive/survive.h46
1 files changed, 4 insertions, 42 deletions
diff --git a/include/libsurvive/survive.h b/include/libsurvive/survive.h
index deb91c4..3bc3b33 100644
--- a/include/libsurvive/survive.h
+++ b/include/libsurvive/survive.h
@@ -136,50 +136,12 @@ void survive_default_angle_process( SurviveObject * so, int sensor_id, int acode
////////////////////// Survive Drivers ////////////////////////////
-// The following macros were taken from StackOverflow here:
-// http://stackoverflow.com/questions/1113409/attribute-constructor-equivalent-in-vc
-// The author, Joe Lowe explicitly released this code into the public domain as part of his post.
-#ifdef __cplusplus
-#define INITIALIZER(f) \
- static void f(void); \
- struct f##_t_ { f##_t_(void) { f(); } }; static f##_t_ f##_; \
- static void f(void)
-#elif defined(_MSC_VER)
-#pragma section(".CRT$XCU",read)
-#define INITIALIZER2_(f,p) \
- __declspec(dllexport) void f(void); \
- __declspec(allocate(".CRT$XCU")) void (*f##_)(void) = f; \
- volatile static void * LTRegistrationPinnerFor##f = &##f; \
- __pragma(comment(linker,"/include:" p #f "_")) \
- void f(void)
-#ifdef _WIN64
-#define INITIALIZER(f) INITIALIZER2_(f,"")
-#else
-#define INITIALIZER(f) INITIALIZER2_(f,"_")
-#endif
+#ifdef _WIN32
+#define REGISTER_LINKTIME( func )
#else
-#define INITIALIZER(f) \
- static void f(void) __attribute__((constructor)); \
- static void f(void)
-#endif
-// End macros from StackOverflow.
-
-//static void foo(void)
-//{
-// int a=0;
-//}
-//
-//INITIALIZER(foo);
-
-
-void RegisterDriver( const char * name, void * data );
-
#define REGISTER_LINKTIME( func ) \
- __declspec(dllexport) void LTRegister##func() { RegisterDriver( #func, &func ); } \
- INITIALIZER(LTRegister##func)
-
-
- //void __attribute__((constructor)) LTRegister##func() { RegisterDriver(#func, &func); }
+ void __attribute__((constructor)) LTRegister##func() { RegisterDriver(#func, &func); }
+#endif