KGantt

libutil.h
1/*
2 * SPDX-FileCopyrightText: 2001-2015 Klaralvdalens Datakonsult AB. All rights reserved.
3 *
4 * This file is part of the KGantt library.
5 *
6 * SPDX-License-Identifier: GPL-2.0-or-later
7 */
8
9#ifndef __ASCSHARED_UTIL_LIBUTIL_H__
10#define __ASCSHARED_UTIL_LIBUTIL_H__
11
12// These two macros can be used to force the loading of static objects in static libraries.
13// Under normal circumstances, the linker automatically discards unused library symbols from the final executable,
14// which is a problem for static objects with a constructor performing a specific action such as registration.
15// Note that the export macro only needs to be included once per .cpp file (even if there are many static objects in the file).
16// Parameters :
17// - ID : an file-wide identifier, e.g. the filename without the extension.
18// It shouldn't be quoted, no spaces, and contain only alphanumerical characters.
19#define KDAB_EXPORT_STATIC_SYMBOLS( ID ) int __init_##ID##_static_symbols() { return 0; }
20#define KDAB_IMPORT_STATIC_SYMBOLS( ID ) extern int __init_##ID##_static_symbols(); \
21 static int fake_init##ID = __init_##ID##_static_symbols();
22
23#endif // __ASCSHARED_UTIL_LIBUTIL_H__
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:09:26 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.