global initializers now created using INITIALIZER macro from
authorStefan Laner <laner@itestra.de>
Tue, 22 Oct 2013 12:59:57 +0000 (14:59 +0200)
committerStefan Laner <laner@itestra.de>
Tue, 22 Oct 2013 12:59:57 +0000 (14:59 +0200)
CommonAPI/types.h

src/CommonAPI/DBus/DBusRuntime.cpp
src/test/commonapi/tests/TestInterfaceDBusProxy.cpp
src/test/commonapi/tests/TestInterfaceDBusStubAdapter.cpp
src/test/fakeLegacyService/fake/legacy/service/LegacyInterfaceDBusProxy.cpp

index 9f21b42..5ac705c 100755 (executable)
@@ -11,15 +11,7 @@ namespace DBus {
 
 const MiddlewareInfo DBusRuntime::middlewareInfo_("DBus", &DBusRuntime::getInstance);
 
-#ifdef WIN32
-#pragma section(".CRT$XCU",read)
-void __cdecl registerDBusMiddleware(void);
-__declspec(allocate(".CRT$XCU")) void(__cdecl*registerDBusMiddleware_)(void) = registerDBusMiddleware;
-void __cdecl
-#else
-__attribute__((constructor)) void
-#endif
- registerDBusMiddleware(void) {
+INITIALIZER(registerDBusMiddleware) {
        Runtime::registerRuntimeLoader("DBus", &DBusRuntime::getInstance);
 }
 
@@ -43,4 +35,4 @@ extern "C" {
 
        CommonAPI::MiddlewareInfo middlewareInfo = CommonAPI::DBus::DBusRuntime::middlewareInfo_;
 
-}
\ No newline at end of file
+}
index fa4674f..5ad1000 100755 (executable)
@@ -16,17 +16,10 @@ std::shared_ptr<CommonAPI::DBus::DBusProxy> createTestInterfaceDBusProxy(
     return std::make_shared<TestInterfaceDBusProxy>(commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection);
 }
 
-#ifdef WIN32
 INITIALIZER(registerTestInterfaceDBusProxy) {
     CommonAPI::DBus::DBusFactory::registerProxyFactoryMethod(TestInterface::getInterfaceId(),
        &createTestInterfaceDBusProxy);
 }
-#else
-__attribute__((constructor)) void registerTestInterfaceDBusProxy(void) {
-    CommonAPI::DBus::DBusFactory::registerProxyFactoryMethod(TestInterface::getInterfaceId(),
-       &createTestInterfaceDBusProxy);
-}
-#endif
 
 TestInterfaceDBusProxy::TestInterfaceDBusProxy(
                     const std::string& commonApiAddress,
index 9107311..661ac82 100755 (executable)
@@ -18,15 +18,9 @@ std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createTestInterfaceDBusStubAda
     return std::make_shared<TestInterfaceDBusStubAdapter>(commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase);
 }
 
-#ifdef WIN32
 INITIALIZER(registerTestInterfaceDBusStubAdapter) {
     CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(TestInterface::getInterfaceId(), &createTestInterfaceDBusStubAdapter);
 }
-#else
-__attribute__((constructor)) void registerTestInterfaceDBusStubAdapter(void) {
-    CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(TestInterface::getInterfaceId(), &createTestInterfaceDBusStubAdapter);
-}
-#endif
 
 TestInterfaceDBusStubAdapter::TestInterfaceDBusStubAdapter(
         const std::string& commonApiAddress,
index 292e0c6..46bdb3b 100644 (file)
@@ -16,7 +16,7 @@ std::shared_ptr<CommonAPI::DBus::DBusProxy> createLegacyInterfaceDBusProxy(
     return std::make_shared<LegacyInterfaceDBusProxy>(commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection);
 }
 
-__attribute__((constructor)) void registerLegacyInterfaceDBusProxy(void) {
+INITIALIZER(registerLegacyInterfaceDBusProxy) {
     CommonAPI::DBus::DBusFactory::registerProxyFactoryMethod(LegacyInterface::getInterfaceId(),
        &createLegacyInterfaceDBusProxy);
 }