diff --git a/CMake/mitkModuleInit.cpp b/CMake/mitkModuleInit.cpp index cab644a9e3..c1f9f937b7 100644 --- a/CMake/mitkModuleInit.cpp +++ b/CMake/mitkModuleInit.cpp @@ -1,82 +1,78 @@ /*============================================================================= Library: CTK Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. =============================================================================*/ #include "mitkStaticInit.h" #include "mitkModuleRegistry.h" #include "mitkModuleContext.h" #include "mitkModule.h" #include "mitkModuleInfo.h" #include "mitkModuleUtils.h" namespace mitk { MITK_GLOBAL_STATIC_WITH_ARGS(ModuleInfo, moduleInfo, ("@MODULE_NAME@", "@MODULE_LIBNAME@", "@MODULE_DEPENDS_STR@", "@MODULE_PACKAGE_DEPENDS_STR@", "@MODULE_VERSION@", @MODULE_QT_BOOL@)) -#if defined(__GNUC__) -class __attribute__ ((visibility ("hidden"))) ModuleInitializer { -#else -class ModuleInitializer { -#endif +class MITK_LOCAL ModuleInitializer { public: ModuleInitializer() { std::string location = ModuleUtils::GetLibraryPath(moduleInfo()->libName, (void*)moduleInfo); std::string activator_func = "_mitk_module_activator_instance_"; activator_func.append(moduleInfo()->name); moduleInfo()->location = location; moduleInfo()->activatorHook = (ModuleInfo::ModuleActivatorHook)ModuleUtils::GetSymbol(location, activator_func.c_str()); Register(); } static void Register() { ModuleRegistry::Register(moduleInfo()); } ~ModuleInitializer() { ModuleRegistry::UnRegister(moduleInfo()); } }; ModuleContext* GetModuleContext() { // make sure the module is registered if (moduleInfo()->id == 0) { ModuleInitializer::Register(); } return ModuleRegistry::GetModule(moduleInfo()->id)->GetModuleContext(); } } static mitk::ModuleInitializer coreModule; diff --git a/Core/Code/Service/mitkGetModuleContext.h b/Core/Code/Service/mitkGetModuleContext.h index 95f46e567c..2d12c86290 100644 --- a/Core/Code/Service/mitkGetModuleContext.h +++ b/Core/Code/Service/mitkGetModuleContext.h @@ -1,48 +1,44 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef MITKGETMODULECONTEXT_H #define MITKGETMODULECONTEXT_H namespace mitk { class ModuleContext; /** * Returns the module context of the calling module. * * This function allows easy access to the own ModuleContext instance from * inside a MITK module. * * \internal * * Note that the corresponding function definition is provided for each * module by the mitkModuleInit.cpp file. This file is customized via CMake * configure_file(...) and automatically compiled into each MITK module. * Consequently, the GetModuleContext function is not exported, since each * module gets its "own version". */ -#if defined(__GNUC__) -__attribute__ ((visibility ("hidden"))) ModuleContext* GetModuleContext(); -#else -ModuleContext* GetModuleContext(); -#endif +MITK_LOCAL ModuleContext* GetModuleContext(); } #endif // MITKGETMODULECONTEXT_H