File indexing completed on 2024-12-15 04:02:45
0001 /* 0002 * SPDX-FileCopyrightText: 2001-2015 Klaralvdalens Datakonsult AB. All rights reserved. 0003 * 0004 * This file is part of the KGantt library. 0005 * 0006 * SPDX-License-Identifier: GPL-2.0-or-later 0007 */ 0008 0009 #ifndef __ASCSHARED_UTIL_LIBUTIL_H__ 0010 #define __ASCSHARED_UTIL_LIBUTIL_H__ 0011 0012 // These two macros can be used to force the loading of static objects in static libraries. 0013 // Under normal circumstances, the linker automatically discards unused library symbols from the final executable, 0014 // which is a problem for static objects with a constructor performing a specific action such as registration. 0015 // Note that the export macro only needs to be included once per .cpp file (even if there are many static objects in the file). 0016 // Parameters : 0017 // - ID : an file-wide identifier, e.g. the filename without the extension. 0018 // It shouldn't be quoted, no spaces, and contain only alphanumerical characters. 0019 #define KDAB_EXPORT_STATIC_SYMBOLS( ID ) int __init_##ID##_static_symbols() { return 0; } 0020 #define KDAB_IMPORT_STATIC_SYMBOLS( ID ) extern int __init_##ID##_static_symbols(); \ 0021 static int fake_init##ID = __init_##ID##_static_symbols(); 0022 0023 #endif // __ASCSHARED_UTIL_LIBUTIL_H__