From: Stefan Laner Date: Tue, 22 Oct 2013 12:59:57 +0000 (+0200) Subject: global initializers now created using INITIALIZER macro from X-Git-Tag: 2.0.9~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f24da69e22bfc51936d47173750e778dee28903f;p=profile%2Fivi%2Fcommon-api-dbus-runtime.git global initializers now created using INITIALIZER macro from CommonAPI/types.h --- diff --git a/src/CommonAPI/DBus/DBusRuntime.cpp b/src/CommonAPI/DBus/DBusRuntime.cpp index 9f21b42..5ac705c 100755 --- a/src/CommonAPI/DBus/DBusRuntime.cpp +++ b/src/CommonAPI/DBus/DBusRuntime.cpp @@ -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 +} diff --git a/src/test/commonapi/tests/TestInterfaceDBusProxy.cpp b/src/test/commonapi/tests/TestInterfaceDBusProxy.cpp index fa4674f..5ad1000 100755 --- a/src/test/commonapi/tests/TestInterfaceDBusProxy.cpp +++ b/src/test/commonapi/tests/TestInterfaceDBusProxy.cpp @@ -16,17 +16,10 @@ std::shared_ptr createTestInterfaceDBusProxy( return std::make_shared(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, diff --git a/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.cpp b/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.cpp index 9107311..661ac82 100755 --- a/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.cpp +++ b/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.cpp @@ -18,15 +18,9 @@ std::shared_ptr createTestInterfaceDBusStubAda return std::make_shared(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, diff --git a/src/test/fakeLegacyService/fake/legacy/service/LegacyInterfaceDBusProxy.cpp b/src/test/fakeLegacyService/fake/legacy/service/LegacyInterfaceDBusProxy.cpp index 292e0c6..46bdb3b 100644 --- a/src/test/fakeLegacyService/fake/legacy/service/LegacyInterfaceDBusProxy.cpp +++ b/src/test/fakeLegacyService/fake/legacy/service/LegacyInterfaceDBusProxy.cpp @@ -16,7 +16,7 @@ std::shared_ptr createLegacyInterfaceDBusProxy( return std::make_shared(commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection); } -__attribute__((constructor)) void registerLegacyInterfaceDBusProxy(void) { +INITIALIZER(registerLegacyInterfaceDBusProxy) { CommonAPI::DBus::DBusFactory::registerProxyFactoryMethod(LegacyInterface::getInterfaceId(), &createLegacyInterfaceDBusProxy); }