added wxDynamicLibrary::HasSymbol()
[wxWidgets.git] / docs / latex / wx / dynlib.tex
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 %% Name: dynlib.tex
3 %% Purpose: wxDynamicLibrary documentation
4 %% Author: Vadim Zeitlin
5 %% Modified by:
6 %% Created: 14.01.02 (extracted from dllload.tex)
7 %% RCS-ID: $Id$
8 %% Copyright: (c) Vadim Zeitlin
9 %% License: wxWidgets license
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
12 \section{\class{wxDynamicLibrary}}\label{wxdynamiclibrary}
13
14 wxDynamicLibrary is a class representing dynamically loadable library
15 (Windows DLL, shared library under Unix etc.). Just create an object of
16 this class to load a library and don't worry about unloading it -- it will be
17 done in the objects destructor automatically.
18
19 % deprecated now...
20 %
21 %\wxheading{See also}
22 %
23 %\helpref{wxDllLoader}{wxdllloader}
24
25
26
27 \membersection{wxDynamicLibrary::wxDynamicLibrary}\label{wxdynamiclibrarywxdynamiclibrary}
28
29 \func{}{wxDynamicLibrary}{\void}
30
31 \func{}{wxDynamicLibrary}{\param{const wxString\& }{name}, \param{int }{flags = wxDL\_DEFAULT}}
32
33 Constructor. Second form calls \helpref{Load}{wxdynamiclibraryload}.
34
35
36 \membersection{wxDynamicLibrary::CanonicalizeName}\label{wxdynamiclibrarycanonicalizename}
37
38 \func{wxString}{CanonicalizeName}{\param{const wxString\& }{name}, \param{wxDynamicLibraryCategory}{ cat = wxDL\_LIBRARY}}
39
40 Returns the platform-specific full name for the library called \arg{name}. E.g.
41 it adds a {\tt ".dll"} extension under Windows and {\tt "lib"} prefix and
42 {\tt ".so"}, {\tt ".sl"} or maybe {\tt ".dylib"} extension under Unix.
43
44 The possible values for \arg{cat} are:
45
46 \begin{twocollist}
47 \twocolitem{wxDL\_LIBRARY}{normal library}
48 \twocolitem{wxDL\_MODULE}{a loadable module or plugin}
49 \end{twocollist}
50
51 \wxheading{See also}
52
53 \helpref{CanonicalizePluginName}{wxdynamiclibrarycanonicalizepluginname}
54
55
56
57 \membersection{wxDynamicLibrary::CanonicalizePluginName}\label{wxdynamiclibrarycanonicalizepluginname}
58
59 \func{wxString}{CanonicalizePluginName}{\param{const wxString\& }{name}, \param{wxPluginCategory}{ cat = wxDL\_PLUGIN\_GUI}}
60
61 This function does the same thing as
62 \helpref{CanonicalizeName}{wxdynamiclibrarycanonicalizename} but for wxWidgets
63 plugins. The only difference is that compiler and version information are added
64 to the name to ensure that the plugin which is going to be loaded will be
65 compatible with the main program.
66
67 The possible values for \arg{cat} are:
68
69 \begin{twocollist}
70 \twocolitem{wxDL\_PLUGIN\_GUI}{plugin which uses GUI classes (default)}
71 \twocolitem{wxDL\_PLUGIN\_BASE}{plugin which only uses wxBase}
72 \end{twocollist}
73
74
75 \membersection{wxDynamicLibrary::Detach}\label{wxdynamiclibrarydetach}
76
77 \func{wxDllType}{Detach}{\void}
78
79 Detaches this object from its library handle, i.e. the object will not unload
80 the library any longer in its destructor but it is now the callers
81 responsability to do this using \helpref{Unload}{wxdynamiclibraryunload}.
82
83
84 \membersection{wxDynamicLibrary::GetSymbol}\label{wxdynamiclibrarygetsymbol}
85
86 \constfunc{void *}{GetSymbol}{\param{const wxString\& }{name}}
87
88 Returns pointer to symbol {\it name} in the library or NULL if the library
89 contains no such symbol.
90
91 \wxheading{See also}
92
93 \helpref{wxDYNLIB\_FUNCTION}{wxdynlibfunction}
94
95
96 \membersection{wxDynamicLibrary::HasSymbol}\label{wxdynamiclibraryhassymbol}
97
98 \constfunc{bool}{HasSymbol}{\param{const wxString\& }{name}}
99
100 Returns \true if the symbol with the given \arg{name} is present in the dynamic
101 library, \false otherwise. Unlike \helpref{GetSymbol}{wxdynamiclibrarygetsymbol},
102 this function doesn't log an error message if the symbol is not found.
103
104 \newsince{2.5.4}
105
106
107 \membersection{wxDynamicLibrary::IsLoaded}\label{wxdynamiclibraryisloaded}
108
109 \constfunc{bool}{IsLoaded}{\void}
110
111 Returns \true if the library was successfully loaded, \false otherwise.
112
113
114 \membersection{wxDynamicLibrary::Load}\label{wxdynamiclibraryload}
115
116 \func{bool}{Load}{\param{const wxString\& }{name}, \param{int }{flags = wxDL\_DEFAULT}}
117
118 Loads DLL with the given \arg{name} into memory. The \arg{flags} argument can
119 be a combination of the following bits:
120
121 \begin{twocollist}
122 \twocolitem{wxDL\_LAZY}{equivalent of RTLD\_LAZY under Unix, ignored elsewhere}
123 \twocolitem{wxDL\_NOW}{equivalent of RTLD\_NOW under Unix, ignored elsewhere}
124 \twocolitem{wxDL\_GLOBAL}{equivalent of RTLD\_GLOBAL under Unix, ignored elsewhere}
125 \twocolitem{wxDL\_VERBATIM}{don't try to append the appropriate extension to
126 the library name (this is done by default).}
127 \end{twocollist}
128
129 Returns \true if the library was successfully loaded, \false otherwise.
130
131
132 \membersection{wxDynamicLibrary::Unload}\label{wxdynamiclibraryunload}
133
134 \func{void}{Unload}{\void}
135
136 \func{static void}{Unload}{\param{wxDllType }{handle}}
137
138 Unloads the library from memory. wxDynamicLibrary object automatically calls
139 this method from its destructor if it had been successfully loaded.
140
141 The second version is only used if you need to keep the library in memory
142 during a longer period of time than the scope of the wxDynamicLibrary object.
143 In this case you may call \helpref{Detach}{wxdynamiclibrarydetach} and store
144 the handle somewhere and call this static method later to unload it.
145