]>
Commit | Line | Data |
---|---|---|
5526e819 | 1 | ///////////////////////////////////////////////////////////////////////////// |
80fdcdb9 | 2 | // Name: wx/html/forcelnk.h |
d49871bc | 3 | // Purpose: macros which force the linker to link apparently unused code |
5526e819 | 4 | // Author: Vaclav Slavik |
69941f05 | 5 | // Copyright: (c) Vaclav Slavik |
65571936 | 6 | // Licence: wxWindows licence |
5526e819 VS |
7 | ///////////////////////////////////////////////////////////////////////////// |
8 | ||
9 | /* | |
10 | ||
11 | DESCRPITON: | |
12 | ||
13 | mod_*.cpp files contain handlers for tags. These files are modules - they contain | |
14 | one wxTagModule class and it's OnInit() method is called from wxApp's init method. | |
15 | The module is called even if you only link it into the executable, so everything | |
16 | seems wonderful. | |
17 | ||
18 | The problem is that we have these modules in LIBRARY and mod_*.cpp files contain | |
19 | no method nor class which is known out of the module. So the linker won't | |
20 | link these .o/.obj files into executable because it detected that it is not used | |
21 | by the program. | |
22 | ||
23 | To workaround this I introduced set of macros FORCE_LINK_ME and FORCE_LINK. These | |
24 | macros are generic and are not limited to mod_*.cpp files. You may find them quite | |
25 | useful somewhere else... | |
26 | ||
27 | How to use them: | |
28 | let's suppose you want to always link file foo.cpp and that you have module | |
29 | always.cpp that is certainly always linked (e.g. the one with main() function | |
30 | or htmlwin.cpp in wxHtml library). | |
31 | ||
32 | Place FORCE_LINK_ME(foo) somewhere in foo.cpp and FORCE_LINK(foo) somewhere | |
33 | in always.cpp | |
34 | See mod_*.cpp and htmlwin.cpp for example :-) | |
35 | ||
36 | */ | |
37 | ||
38 | ||
69941f05 VS |
39 | #ifndef _WX_FORCELNK_H_ |
40 | #define _WX_FORCELNK_H_ | |
5526e819 | 41 | |
df6ddd97 VZ |
42 | #include "wx/link.h" |
43 | ||
6cf2fb76 VZ |
44 | // compatibility defines |
45 | #define FORCE_LINK wxFORCE_LINK_MODULE | |
46 | #define FORCE_LINK_ME wxFORCE_LINK_THIS_MODULE | |
5526e819 | 47 | |
0cecad31 VS |
48 | #define FORCE_WXHTML_MODULES() \ |
49 | FORCE_LINK(m_layout) \ | |
50 | FORCE_LINK(m_fonts) \ | |
51 | FORCE_LINK(m_image) \ | |
52 | FORCE_LINK(m_list) \ | |
53 | FORCE_LINK(m_dflist) \ | |
54 | FORCE_LINK(m_pre) \ | |
55 | FORCE_LINK(m_hline) \ | |
56 | FORCE_LINK(m_links) \ | |
57 | FORCE_LINK(m_tables) \ | |
f68e16c5 | 58 | FORCE_LINK(m_span) \ |
c44fdc94 | 59 | FORCE_LINK(m_style) |
0cecad31 | 60 | |
5526e819 | 61 | |
69941f05 | 62 | #endif // _WX_FORCELNK_H_ |