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