00001 #ifndef __ASCSHARED_UTIL_LIBUTIL_H__ 00002 #define __ASCSHARED_UTIL_LIBUTIL_H__ 00003 00004 // These two macros can be used to force the loading of static objects in static libraries. 00005 // Under normal circumstances, the linker automatically discards unused library symbols from the final executable, 00006 // which is a problem for static objects with a constructor performing a specific action such as registration. 00007 // Note that the export macro only needs to be included once per .cpp file (even if there are many static objects in the file). 00008 // Parameters : 00009 // - ID : an file-wide identifier, e.g. the filename without the extension. 00010 // It shouldn't be quoted, no spaces, and contain only alphanumerical characters. 00011 #define KDAB_EXPORT_STATIC_SYMBOLS( ID ) int __init_##ID##_static_symbols(){ return 0; } 00012 #define KDAB_IMPORT_STATIC_SYMBOLS( ID ) extern int __init_##ID##_static_symbols(); \ 00013 static int fake_init##ID = __init_##ID##_static_symbols(); 00014 00015 #endif // __ASCSHARED_UTIL_LIBUTIL_H__