]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/html/forcelnk.h
8cb3e9662f8adbfff3b96a80c64770b0635ae963
1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Vaclav Slavik
6 // Copyright: (c) Vaclav Slavik
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
14 mod_*.cpp files contain handlers for tags. These files are modules - they contain
15 one wxTagModule class and it's OnInit() method is called from wxApp's init method.
16 The module is called even if you only link it into the executable, so everything
19 The problem is that we have these modules in LIBRARY and mod_*.cpp files contain
20 no method nor class which is known out of the module. So the linker won't
21 link these .o/.obj files into executable because it detected that it is not used
24 To workaround this I introduced set of macros FORCE_LINK_ME and FORCE_LINK. These
25 macros are generic and are not limited to mod_*.cpp files. You may find them quite
26 useful somewhere else...
29 let's suppose you want to always link file foo.cpp and that you have module
30 always.cpp that is certainly always linked (e.g. the one with main() function
31 or htmlwin.cpp in wxHtml library).
33 Place FORCE_LINK_ME(foo) somewhere in foo.cpp and FORCE_LINK(foo) somewhere
35 See mod_*.cpp and htmlwin.cpp for example :-)
40 #ifndef _WX_FORCELNK_H_
41 #define _WX_FORCELNK_H_
45 // compatibility defines
46 #define FORCE_LINK wxFORCE_LINK_MODULE
47 #define FORCE_LINK_ME wxFORCE_LINK_THIS_MODULE
49 #define FORCE_WXHTML_MODULES() \
50 FORCE_LINK(m_layout) \
54 FORCE_LINK(m_dflist) \
58 FORCE_LINK(m_tables) \
62 #endif // _WX_FORCELNK_H_