diff options
author | mwturvey <michael.w.turvey@intel.com> | 2017-03-16 10:31:19 -0700 |
---|---|---|
committer | mwturvey <michael.w.turvey@intel.com> | 2017-03-16 10:31:19 -0700 |
commit | fa0f4825937ed93163bb2cd165c001d7444d8928 (patch) | |
tree | 97f4eb9c6f3e0b35c634aa8ddf0fc9699c09fc69 /include/libsurvive | |
parent | a409645cd3e2b8f0cc67541a9e4c88bf2cd96a79 (diff) | |
download | libsurvive-fa0f4825937ed93163bb2cd165c001d7444d8928.tar.gz libsurvive-fa0f4825937ed93163bb2cd165c001d7444d8928.tar.bz2 |
Last try at getting linktime registration working under MSVC
Diffstat (limited to 'include/libsurvive')
-rw-r--r-- | include/libsurvive/survive.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/libsurvive/survive.h b/include/libsurvive/survive.h index 2663c57..deb91c4 100644 --- a/include/libsurvive/survive.h +++ b/include/libsurvive/survive.h @@ -149,6 +149,7 @@ void survive_default_angle_process( SurviveObject * so, int sensor_id, int acode #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 @@ -176,6 +177,9 @@ 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); } |