]>
Commit | Line | Data |
---|---|---|
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 | ||
14 | wxDynamicLibrary is a class representing dynamically loadable library | |
169948a0 VZ |
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. | |
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 |
27 | No 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 | |
43 | Constructor. Second form calls \helpref{Load}{wxdynamiclibraryload}. | |
44 | ||
a018a119 | 45 | |
169948a0 VZ |
46 | \membersection{wxDynamicLibrary::CanonicalizeName}\label{wxdynamiclibrarycanonicalizename} |
47 | ||
5bb31e35 | 48 | \func{wxString}{CanonicalizeName}{\param{const wxString\& }{name}, \param{wxDynamicLibraryCategory}{ cat = wxDL\_LIBRARY}} |
169948a0 VZ |
49 | |
50 | Returns the platform-specific full name for the library called \arg{name}. E.g. | |
51 | it 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 | ||
54 | The 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 | ||
5bb31e35 | 69 | \func{wxString}{CanonicalizePluginName}{\param{const wxString\& }{name}, \param{wxPluginCategory}{ cat = wxDL\_PLUGIN\_GUI}} |
169948a0 VZ |
70 | |
71 | This function does the same thing as | |
fc2171bd | 72 | \helpref{CanonicalizeName}{wxdynamiclibrarycanonicalizename} but for wxWidgets |
169948a0 VZ |
73 | plugins. The only difference is that compiler and version information are added |
74 | to the name to ensure that the plugin which is going to be loaded will be | |
75 | compatible with the main program. | |
76 | ||
77 | The 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 | ||
89 | Detaches this object from its library handle, i.e. the object will not unload | |
90 | the library any longer in its destructor but it is now the callers | |
169948a0 VZ |
91 | responsability to do this using \helpref{Unload}{wxdynamiclibraryunload}. |
92 | ||
a018a119 | 93 | |
169948a0 VZ |
94 | \membersection{wxDynamicLibrary::GetSymbol}\label{wxdynamiclibrarygetsymbol} |
95 | ||
a018a119 | 96 | \constfunc{void *}{GetSymbol}{\param{const wxString\& }{name}} |
169948a0 VZ |
97 | |
98 | Returns pointer to symbol {\it name} in the library or NULL if the library | |
99 | contains no such symbol. | |
100 | ||
101 | \wxheading{See also} | |
102 | ||
103 | \helpref{wxDYNLIB\_FUNCTION}{wxdynlibfunction} | |
104 | ||
a018a119 VZ |
105 | |
106 | \membersection{wxDynamicLibrary::HasSymbol}\label{wxdynamiclibraryhassymbol} | |
107 | ||
108 | \constfunc{bool}{HasSymbol}{\param{const wxString\& }{name}} | |
109 | ||
110 | Returns \true if the symbol with the given \arg{name} is present in the dynamic | |
111 | library, \false otherwise. Unlike \helpref{GetSymbol}{wxdynamiclibrarygetsymbol}, | |
112 | this function doesn't log an error message if the symbol is not found. | |
113 | ||
114 | \newsince{2.5.4} | |
115 | ||
116 | ||
f3845e88 VZ |
117 | \membersection{wxDynamicLibrary::IsLoaded}\label{wxdynamiclibraryisloaded} |
118 | ||
119 | \constfunc{bool}{IsLoaded}{\void} | |
120 | ||
169948a0 VZ |
121 | Returns \true if the library was successfully loaded, \false otherwise. |
122 | ||
a018a119 | 123 | |
defbed48 VZ |
124 | \membersection{wxDynamicLibrary::ListLoaded}\label{wxdynamiclibrarylistloaded} |
125 | ||
126 | \func{static wxDynamicLibraryDetailsArray}{ListLoaded}{\void} | |
127 | ||
128 | This static method returns an \helpref{array}{wxarray} containing the details | |
129 | of all modules loaded into the address space of the current project, the array | |
130 | elements are object of \texttt{wxDynamicLibraryDetails} class. The array will | |
131 | be empty if an error occured. | |
132 | ||
297ebe6b VZ |
133 | This method is currently implemented only under Win32 and Linux and is useful |
134 | mostly for diagnostics purposes. | |
defbed48 VZ |
135 | |
136 | ||
f3845e88 VZ |
137 | \membersection{wxDynamicLibrary::Load}\label{wxdynamiclibraryload} |
138 | ||
169948a0 | 139 | \func{bool}{Load}{\param{const wxString\& }{name}, \param{int }{flags = wxDL\_DEFAULT}} |
f3845e88 | 140 | |
169948a0 VZ |
141 | Loads DLL with the given \arg{name} into memory. The \arg{flags} argument can |
142 | be a combination of the following bits: | |
d2c2afc9 | 143 | |
169948a0 VZ |
144 | \begin{twocollist} |
145 | \twocolitem{wxDL\_LAZY}{equivalent of RTLD\_LAZY under Unix, ignored elsewhere} | |
146 | \twocolitem{wxDL\_NOW}{equivalent of RTLD\_NOW under Unix, ignored elsewhere} | |
147 | \twocolitem{wxDL\_GLOBAL}{equivalent of RTLD\_GLOBAL under Unix, ignored elsewhere} | |
148 | \twocolitem{wxDL\_VERBATIM}{don't try to append the appropriate extension to | |
149 | the library name (this is done by default).} | |
e62e17d7 | 150 | \twocolitem{wxDL\_DEFAULT}{default flags, same as wxDL\_NOW currently} |
169948a0 | 151 | \end{twocollist} |
f3845e88 | 152 | |
169948a0 | 153 | Returns \true if the library was successfully loaded, \false otherwise. |
f3845e88 | 154 | |
a018a119 | 155 | |
169948a0 | 156 | \membersection{wxDynamicLibrary::Unload}\label{wxdynamiclibraryunload} |
f3845e88 | 157 | |
169948a0 | 158 | \func{void}{Unload}{\void} |
f3845e88 | 159 | |
169948a0 | 160 | \func{static void}{Unload}{\param{wxDllType }{handle}} |
f3845e88 | 161 | |
169948a0 VZ |
162 | Unloads the library from memory. wxDynamicLibrary object automatically calls |
163 | this method from its destructor if it had been successfully loaded. | |
4104ed92 | 164 | |
169948a0 VZ |
165 | The second version is only used if you need to keep the library in memory |
166 | during a longer period of time than the scope of the wxDynamicLibrary object. | |
167 | In this case you may call \helpref{Detach}{wxdynamiclibrarydetach} and store | |
168 | the handle somewhere and call this static method later to unload it. | |
f3845e88 | 169 | |
defbed48 VZ |
170 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
171 | ||
172 | \section{\class{wxDynamicLibraryDetails}}\label{wxdynamiclibrarydetails} | |
173 | ||
174 | This class is used for the objects returned by | |
175 | \helpref{wxDynamicLibrary::ListLoaded}{wxdynamiclibrarylistloaded} method and | |
176 | contains the information about a single module loaded into the address space of | |
177 | the current process. A module in this context may be either a dynamic library | |
178 | or the main program itself. | |
179 | ||
180 | \wxheading{Derived from} | |
181 | ||
182 | No base class. | |
183 | ||
184 | \wxheading{Include files} | |
185 | ||
186 | <wx/dynlib.h> | |
187 | ||
188 | (only available if \texttt{wxUSE\_DYNLIB\_CLASS} is set to $1$) | |
189 | ||
190 | \latexignore{\rtfignore{\wxheading{Members}}} | |
191 | ||
192 | \membersection{wxDynamicLibraryDetails::GetName}\label{wxdynamiclibrarygetname} | |
193 | ||
194 | \constfunc{wxString}{GetName}{\void} | |
195 | ||
196 | Returns the base name of this module, e.g. \texttt{kernel32.dll} or | |
197 | \texttt{libc-2.3.2.so}. | |
198 | ||
199 | ||
200 | \membersection{wxDynamicLibraryDetails::GetPath}\label{wxdynamiclibrarygetpath} | |
201 | ||
202 | \constfunc{wxString}{GetPath}{\void} | |
203 | ||
204 | Returns the full path of this module if available, e.g. | |
205 | \texttt{c:$\backslash$windows$\backslash$system32$\backslash$kernel32.dll} or | |
206 | \texttt{/lib/libc-2.3.2.so}. | |
207 | ||
208 | ||
209 | \membersection{wxDynamicLibraryDetails::GetAddress}\label{wxdynamiclibrarygetaddress} | |
210 | ||
211 | \constfunc{bool}{GetAddress}{\param{void **}{addr}, \param{size\_t }{*len}} | |
212 | ||
213 | Retrieves the load address and the size of this module. | |
214 | ||
215 | \wxheading{Parameters} | |
216 | ||
217 | \docparam{addr}{the pointer to the location to return load address in, may be | |
218 | \texttt{NULL}} | |
219 | ||
220 | \docparam{len}{pointer to the location to return the size of this module in | |
221 | memory in, may be \texttt{NULL}} | |
222 | ||
223 | \wxheading{Return value} | |
224 | ||
225 | \true if the load address and module size were retrieved, \false if this | |
226 | information is not available. | |
227 | ||
228 | ||
229 | \membersection{wxDynamicLibraryDetails::GetVersion}\label{wxdynamiclibrarygetversion} | |
230 | ||
231 | \constfunc{wxString}{GetVersion}{\void} | |
232 | ||
233 | Returns the version of this module, e.g. \texttt{5.2.3790.0} or | |
234 | \texttt{2.3.2}. The returned string is empty if the version information is not | |
235 | available. | |
236 |