]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/dynlib.tex
Typo correction
[wxWidgets.git] / docs / latex / wx / dynlib.tex
CommitLineData
f3845e88
VZ
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%% Name: dynlib.tex
defbed48 3%% Purpose: wxDynamicLibrary and wxDynamicLibraryDetails documentation
f3845e88
VZ
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
8795498c 9%% License: wxWindows license
f3845e88
VZ
10%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
12\section{\class{wxDynamicLibrary}}\label{wxdynamiclibrary}
13
14wxDynamicLibrary is a class representing dynamically loadable library
169948a0
VZ
15(Windows DLL, shared library under Unix etc.). Just create an object of
16this class to load a library and don't worry about unloading it -- it will be
17done in the objects destructor automatically.
f3845e88 18
169948a0
VZ
19% deprecated now...
20%
21%\wxheading{See also}
22%
23%\helpref{wxDllLoader}{wxdllloader}
f3845e88 24
defbed48 25\wxheading{Derived from}
f3845e88 26
defbed48
VZ
27No base class.
28
29\wxheading{Include files}
30
31<wx/dynlib.h>
32
33(only available if \texttt{wxUSE\_DYNLIB\_CLASS} is set to $1$)
34
35\latexignore{\rtfignore{\wxheading{Members}}}
a018a119 36
f3845e88
VZ
37\membersection{wxDynamicLibrary::wxDynamicLibrary}\label{wxdynamiclibrarywxdynamiclibrary}
38
39\func{}{wxDynamicLibrary}{\void}
40
169948a0 41\func{}{wxDynamicLibrary}{\param{const wxString\& }{name}, \param{int }{flags = wxDL\_DEFAULT}}
f3845e88
VZ
42
43Constructor. Second form calls \helpref{Load}{wxdynamiclibraryload}.
44
a018a119 45
169948a0
VZ
46\membersection{wxDynamicLibrary::CanonicalizeName}\label{wxdynamiclibrarycanonicalizename}
47
08890e27 48\func{static wxString}{CanonicalizeName}{\param{const wxString\& }{name}, \param{wxDynamicLibraryCategory}{ cat = wxDL\_LIBRARY}}
169948a0
VZ
49
50Returns the platform-specific full name for the library called \arg{name}. E.g.
51it adds a {\tt ".dll"} extension under Windows and {\tt "lib"} prefix and
52{\tt ".so"}, {\tt ".sl"} or maybe {\tt ".dylib"} extension under Unix.
53
54The possible values for \arg{cat} are:
5bb31e35 55
169948a0
VZ
56\begin{twocollist}
57 \twocolitem{wxDL\_LIBRARY}{normal library}
58 \twocolitem{wxDL\_MODULE}{a loadable module or plugin}
59\end{twocollist}
60
61\wxheading{See also}
62
63\helpref{CanonicalizePluginName}{wxdynamiclibrarycanonicalizepluginname}
64
65
a018a119 66
169948a0
VZ
67\membersection{wxDynamicLibrary::CanonicalizePluginName}\label{wxdynamiclibrarycanonicalizepluginname}
68
08890e27 69\func{static wxString}{CanonicalizePluginName}{\param{const wxString\& }{name}, \param{wxPluginCategory}{ cat = wxDL\_PLUGIN\_GUI}}
169948a0
VZ
70
71This function does the same thing as
fc2171bd 72\helpref{CanonicalizeName}{wxdynamiclibrarycanonicalizename} but for wxWidgets
169948a0
VZ
73plugins. The only difference is that compiler and version information are added
74to the name to ensure that the plugin which is going to be loaded will be
75compatible with the main program.
76
77The possible values for \arg{cat} are:
5bb31e35 78
169948a0
VZ
79\begin{twocollist}
80 \twocolitem{wxDL\_PLUGIN\_GUI}{plugin which uses GUI classes (default)}
81 \twocolitem{wxDL\_PLUGIN\_BASE}{plugin which only uses wxBase}
82\end{twocollist}
83
a018a119 84
9ae2ec95
VZ
85\membersection{wxDynamicLibrary::Detach}\label{wxdynamiclibrarydetach}
86
87\func{wxDllType}{Detach}{\void}
88
89Detaches this object from its library handle, i.e. the object will not unload
90the library any longer in its destructor but it is now the callers
43e8916f 91responsibility to do this using \helpref{Unload}{wxdynamiclibraryunload}.
169948a0 92
a018a119 93
08890e27
VZ
94\membersection{wxDynamicLibrary::GetProgramHandle}\label{wxdynamiclibrarygetprogramhandle}
95
96\func{static wxDllType}{GetProgramHandle}{\void}
97
98Return a valid handle for the main program itself or \texttt{NULL} if symbols
99from the main program can't be loaded on this platform.
100
101
169948a0
VZ
102\membersection{wxDynamicLibrary::GetSymbol}\label{wxdynamiclibrarygetsymbol}
103
a018a119 104\constfunc{void *}{GetSymbol}{\param{const wxString\& }{name}}
169948a0
VZ
105
106Returns pointer to symbol {\it name} in the library or NULL if the library
107contains no such symbol.
108
109\wxheading{See also}
110
111\helpref{wxDYNLIB\_FUNCTION}{wxdynlibfunction}
112
a018a119 113
93ed8ff7
VZ
114\membersection{wxDynamicLibrary::GetSymbolAorW}\label{wxdynamiclibrarygetsymbolaorw}
115
116\constfunc{void *}{GetSymbolAorW}{\param{const wxString\& }{name}}
117
118This function is available only under Windows as it is only useful when
119dynamically loading symbols from standard Windows DLLs. Such functions have
120either \texttt{'A'} (in ANSI build) or \texttt{'W'} (in Unicode, or wide
121character build) suffix if they take string parameters. Using this function you
122can use just the base name of the function and the correct suffix is appende
123automatically depending on the current build. Otherwise, this method is
124identical to \helpref{GetSymbol}{wxdynamiclibrarygetsymbol}.
125
126
6d94009f
VZ
127\membersection{wxDynamicLibrary::GetProgramHandle}\label{wxdynamiclibrarygetprogramhandle}
128
129\func{static wxDllType}{GetProgramHandle}{\void}
130
131Return a valid handle for the main program itself or \texttt{NULL} if symbols
132from the main program can't be loaded on this platform.
133
134
a018a119
VZ
135\membersection{wxDynamicLibrary::HasSymbol}\label{wxdynamiclibraryhassymbol}
136
137\constfunc{bool}{HasSymbol}{\param{const wxString\& }{name}}
138
139Returns \true if the symbol with the given \arg{name} is present in the dynamic
140library, \false otherwise. Unlike \helpref{GetSymbol}{wxdynamiclibrarygetsymbol},
141this function doesn't log an error message if the symbol is not found.
142
143\newsince{2.5.4}
144
145
f3845e88
VZ
146\membersection{wxDynamicLibrary::IsLoaded}\label{wxdynamiclibraryisloaded}
147
148\constfunc{bool}{IsLoaded}{\void}
149
169948a0
VZ
150Returns \true if the library was successfully loaded, \false otherwise.
151
a018a119 152
defbed48
VZ
153\membersection{wxDynamicLibrary::ListLoaded}\label{wxdynamiclibrarylistloaded}
154
155\func{static wxDynamicLibraryDetailsArray}{ListLoaded}{\void}
156
157This static method returns an \helpref{array}{wxarray} containing the details
158of all modules loaded into the address space of the current project, the array
159elements are object of \texttt{wxDynamicLibraryDetails} class. The array will
43e8916f 160be empty if an error occurred.
defbed48 161
297ebe6b
VZ
162This method is currently implemented only under Win32 and Linux and is useful
163mostly for diagnostics purposes.
defbed48
VZ
164
165
f3845e88
VZ
166\membersection{wxDynamicLibrary::Load}\label{wxdynamiclibraryload}
167
169948a0 168\func{bool}{Load}{\param{const wxString\& }{name}, \param{int }{flags = wxDL\_DEFAULT}}
f3845e88 169
169948a0
VZ
170Loads DLL with the given \arg{name} into memory. The \arg{flags} argument can
171be a combination of the following bits:
d2c2afc9 172
169948a0
VZ
173\begin{twocollist}
174\twocolitem{wxDL\_LAZY}{equivalent of RTLD\_LAZY under Unix, ignored elsewhere}
175\twocolitem{wxDL\_NOW}{equivalent of RTLD\_NOW under Unix, ignored elsewhere}
176\twocolitem{wxDL\_GLOBAL}{equivalent of RTLD\_GLOBAL under Unix, ignored elsewhere}
177\twocolitem{wxDL\_VERBATIM}{don't try to append the appropriate extension to
178the library name (this is done by default).}
e62e17d7 179\twocolitem{wxDL\_DEFAULT}{default flags, same as wxDL\_NOW currently}
169948a0 180\end{twocollist}
f3845e88 181
169948a0 182Returns \true if the library was successfully loaded, \false otherwise.
f3845e88 183
a018a119 184
169948a0 185\membersection{wxDynamicLibrary::Unload}\label{wxdynamiclibraryunload}
f3845e88 186
169948a0 187\func{void}{Unload}{\void}
f3845e88 188
169948a0 189\func{static void}{Unload}{\param{wxDllType }{handle}}
f3845e88 190
169948a0
VZ
191Unloads the library from memory. wxDynamicLibrary object automatically calls
192this method from its destructor if it had been successfully loaded.
4104ed92 193
169948a0
VZ
194The second version is only used if you need to keep the library in memory
195during a longer period of time than the scope of the wxDynamicLibrary object.
196In this case you may call \helpref{Detach}{wxdynamiclibrarydetach} and store
197the handle somewhere and call this static method later to unload it.
f3845e88 198
defbed48
VZ
199%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
200
201\section{\class{wxDynamicLibraryDetails}}\label{wxdynamiclibrarydetails}
202
203This class is used for the objects returned by
204\helpref{wxDynamicLibrary::ListLoaded}{wxdynamiclibrarylistloaded} method and
205contains the information about a single module loaded into the address space of
206the current process. A module in this context may be either a dynamic library
207or the main program itself.
208
209\wxheading{Derived from}
210
211No base class.
212
213\wxheading{Include files}
214
215<wx/dynlib.h>
216
217(only available if \texttt{wxUSE\_DYNLIB\_CLASS} is set to $1$)
218
219\latexignore{\rtfignore{\wxheading{Members}}}
220
221\membersection{wxDynamicLibraryDetails::GetName}\label{wxdynamiclibrarygetname}
222
223\constfunc{wxString}{GetName}{\void}
224
225Returns the base name of this module, e.g. \texttt{kernel32.dll} or
226\texttt{libc-2.3.2.so}.
227
228
229\membersection{wxDynamicLibraryDetails::GetPath}\label{wxdynamiclibrarygetpath}
230
231\constfunc{wxString}{GetPath}{\void}
232
233Returns the full path of this module if available, e.g.
234\texttt{c:$\backslash$windows$\backslash$system32$\backslash$kernel32.dll} or
235\texttt{/lib/libc-2.3.2.so}.
236
237
238\membersection{wxDynamicLibraryDetails::GetAddress}\label{wxdynamiclibrarygetaddress}
239
240\constfunc{bool}{GetAddress}{\param{void **}{addr}, \param{size\_t }{*len}}
241
242Retrieves the load address and the size of this module.
243
244\wxheading{Parameters}
245
246\docparam{addr}{the pointer to the location to return load address in, may be
247\texttt{NULL}}
248
249\docparam{len}{pointer to the location to return the size of this module in
250memory in, may be \texttt{NULL}}
251
252\wxheading{Return value}
253
254\true if the load address and module size were retrieved, \false if this
255information is not available.
256
257
258\membersection{wxDynamicLibraryDetails::GetVersion}\label{wxdynamiclibrarygetversion}
259
260\constfunc{wxString}{GetVersion}{\void}
261
262Returns the version of this module, e.g. \texttt{5.2.3790.0} or
263\texttt{2.3.2}. The returned string is empty if the version information is not
264available.
265