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