link.h 1.4 KB

12345678910111213141516171819202122232425262728293031
  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. // Copyright: (c) Vaclav Slavik
  7. // Licence: wxWindows licence
  8. /////////////////////////////////////////////////////////////////////////////
  9. #ifndef _WX_LINK_H_
  10. #define _WX_LINK_H_
  11. // This must be part of the module you want to force:
  12. #define wxFORCE_LINK_THIS_MODULE(module_name) \
  13. extern void _wx_link_dummy_func_##module_name (); \
  14. void _wx_link_dummy_func_##module_name () { }
  15. // And this must be somewhere where it certainly will be linked:
  16. #define wxFORCE_LINK_MODULE(module_name) \
  17. extern void _wx_link_dummy_func_##module_name (); \
  18. static struct wxForceLink##module_name \
  19. { \
  20. wxForceLink##module_name() \
  21. { \
  22. _wx_link_dummy_func_##module_name (); \
  23. } \
  24. } _wx_link_dummy_var_##module_name;
  25. #endif // _WX_LINK_H_