| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: wx/link.h |
| 3 | // Purpose: macros to force linking modules which might otherwise be |
| 4 | // discarded by the linker |
| 5 | // Author: Vaclav Slavik |
| 6 | // RCS-ID: $Id$ |
| 7 | // Copyright: (c) Vaclav Slavik |
| 8 | // Licence: wxWindows licence |
| 9 | ///////////////////////////////////////////////////////////////////////////// |
| 10 | |
| 11 | #ifndef _WX_LINK_H_ |
| 12 | #define _WX_LINK_H_ |
| 13 | |
| 14 | // This must be part of the module you want to force: |
| 15 | #define wxFORCE_LINK_THIS_MODULE(module_name) \ |
| 16 | extern void _wx_link_dummy_func_##module_name (); \ |
| 17 | void _wx_link_dummy_func_##module_name () { } |
| 18 | |
| 19 | |
| 20 | // And this must be somewhere where it certainly will be linked: |
| 21 | #define wxFORCE_LINK_MODULE(module_name) \ |
| 22 | extern void _wx_link_dummy_func_##module_name (); \ |
| 23 | static struct wxForceLink##module_name \ |
| 24 | { \ |
| 25 | wxForceLink##module_name() \ |
| 26 | { \ |
| 27 | _wx_link_dummy_func_##module_name (); \ |
| 28 | } \ |
| 29 | } _wx_link_dummy_var_##module_name; |
| 30 | |
| 31 | |
| 32 | #endif // _WX_LINK_H_ |