00001 /**************************************************************************** 00002 ** Copyright (C) 2001-2011 Klaralvdalens Datakonsult AB. All rights reserved. 00003 ** 00004 ** This file is part of the KD Chart library. 00005 ** 00006 ** Licensees holding valid commercial KD Chart licenses may use this file in 00007 ** accordance with the KD Chart Commercial License Agreement provided with 00008 ** the Software. 00009 ** 00010 ** 00011 ** This file may be distributed and/or modified under the terms of the 00012 ** GNU General Public License version 2 and version 3 as published by the 00013 ** Free Software Foundation and appearing in the file LICENSE.GPL.txt included. 00014 ** 00015 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00016 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00017 ** 00018 ** Contact info@kdab.com if any conditions of this licensing are not 00019 ** clear to you. 00020 ** 00021 **********************************************************************/ 00022 00023 #ifndef __ASCSHARED_UTIL_LIBUTIL_H__ 00024 #define __ASCSHARED_UTIL_LIBUTIL_H__ 00025 00026 // These two macros can be used to force the loading of static objects in static libraries. 00027 // Under normal circumstances, the linker automatically discards unused library symbols from the final executable, 00028 // which is a problem for static objects with a constructor performing a specific action such as registration. 00029 // Note that the export macro only needs to be included once per .cpp file (even if there are many static objects in the file). 00030 // Parameters : 00031 // - ID : an file-wide identifier, e.g. the filename without the extension. 00032 // It shouldn't be quoted, no spaces, and contain only alphanumerical characters. 00033 #define KDAB_EXPORT_STATIC_SYMBOLS( ID ) int __init_##ID##_static_symbols(){ return 0; } 00034 #define KDAB_IMPORT_STATIC_SYMBOLS( ID ) extern int __init_##ID##_static_symbols(); \ 00035 static int fake_init##ID = __init_##ID##_static_symbols(); 00036 00037 #endif // __ASCSHARED_UTIL_LIBUTIL_H__