KD Chart 2  [rev.2.7]
libutil.h
Go to the documentation of this file.
1 /****************************************************************************
2 ** Copyright (C) 2001-2020 Klaralvdalens Datakonsult AB. All rights reserved.
3 **
4 ** This file is part of the KD Chart library.
5 **
6 ** Licensees holding valid commercial KD Chart licenses may use this file in
7 ** accordance with the KD Chart Commercial License Agreement provided with
8 ** the Software.
9 **
10 **
11 ** This file may be distributed and/or modified under the terms of the
12 ** GNU General Public License version 2 and version 3 as published by the
13 ** Free Software Foundation and appearing in the file LICENSE.GPL.txt included.
14 **
15 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17 **
18 ** Contact info@kdab.com if any conditions of this licensing are not
19 ** clear to you.
20 **
21 **********************************************************************/
22 
23 #ifndef __ASCSHARED_UTIL_LIBUTIL_H__
24 #define __ASCSHARED_UTIL_LIBUTIL_H__
25 
26 // These two macros can be used to force the loading of static objects in static libraries.
27 // Under normal circumstances, the linker automatically discards unused library symbols from the final executable,
28 // which is a problem for static objects with a constructor performing a specific action such as registration.
29 // Note that the export macro only needs to be included once per .cpp file (even if there are many static objects in the file).
30 // Parameters :
31 // - ID : an file-wide identifier, e.g. the filename without the extension.
32 // It shouldn't be quoted, no spaces, and contain only alphanumerical characters.
33 #define KDAB_EXPORT_STATIC_SYMBOLS( ID ) int __init_##ID##_static_symbols() { return 0; }
34 #define KDAB_IMPORT_STATIC_SYMBOLS( ID ) extern int __init_##ID##_static_symbols(); \
35  static int fake_init##ID = __init_##ID##_static_symbols();
36 
37 #endif // __ASCSHARED_UTIL_LIBUTIL_H__

Klarälvdalens Datakonsult AB (KDAB)
Qt-related services and products
https://www.kdab.com/
https://www.kdab.com/products/kd-chart/