1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %% Purpose: wxDynamicLibrary and wxDynamicLibraryDetails documentation
4 %% Author: Vadim Zeitlin
6 %% Created: 14.01.02 (extracted from dllload.tex)
8 %% Copyright: (c) Vadim Zeitlin
9 %% License: wxWindows license
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12 \section{\class{wxDynamicLibrary
}}\label{wxdynamiclibrary
}
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.
19 \wxheading{Derived from
}
23 \wxheading{Include files
}
29 \helpref{wxBase
}{librarieslist
}
31 (only available if
\texttt{wxUSE
\_DYNLIB\_CLASS} is set to $
1$)
33 \latexignore{\rtfignore{\wxheading{Members
}}}
35 \membersection{wxDynamicLibrary::wxDynamicLibrary
}\label{wxdynamiclibrarywxdynamiclibrary
}
37 \func{}{wxDynamicLibrary
}{\void}
39 \func{}{wxDynamicLibrary
}{\param{const wxString\&
}{name
},
\param{int
}{flags = wxDL
\_DEFAULT}}
41 Constructor. Second form calls
\helpref{Load
}{wxdynamiclibraryload
}.
44 \membersection{wxDynamicLibrary::CanonicalizeName
}\label{wxdynamiclibrarycanonicalizename
}
46 \func{static wxString
}{CanonicalizeName
}{\param{const wxString\&
}{name
},
\param{wxDynamicLibraryCategory
}{ cat = wxDL
\_LIBRARY}}
48 Returns the platform-specific full name for the library called
\arg{name
}. E.g.
49 it adds a
{\tt ".dll"
} extension under Windows and
{\tt "lib"
} prefix and
50 {\tt ".so"
},
{\tt ".sl"
} or maybe
{\tt ".dylib"
} extension under Unix.
52 The possible values for
\arg{cat
} are:
55 \twocolitem{wxDL
\_LIBRARY}{normal library
}
56 \twocolitem{wxDL
\_MODULE}{a loadable module or plugin
}
61 \helpref{CanonicalizePluginName
}{wxdynamiclibrarycanonicalizepluginname
}
65 \membersection{wxDynamicLibrary::CanonicalizePluginName
}\label{wxdynamiclibrarycanonicalizepluginname
}
67 \func{static wxString
}{CanonicalizePluginName
}{\param{const wxString\&
}{name
},
\param{wxPluginCategory
}{ cat = wxDL
\_PLUGIN\_GUI}}
69 This function does the same thing as
70 \helpref{CanonicalizeName
}{wxdynamiclibrarycanonicalizename
} but for wxWidgets
71 plugins. The only difference is that compiler and version information are added
72 to the name to ensure that the plugin which is going to be loaded will be
73 compatible with the main program.
75 The possible values for
\arg{cat
} are:
78 \twocolitem{wxDL
\_PLUGIN\_GUI}{plugin which uses GUI classes (default)
}
79 \twocolitem{wxDL
\_PLUGIN\_BASE}{plugin which only uses wxBase
}
83 \membersection{wxDynamicLibrary::Detach
}\label{wxdynamiclibrarydetach
}
85 \func{wxDllType
}{Detach
}{\void}
87 Detaches this object from its library handle, i.e. the object will not unload
88 the library any longer in its destructor but it is now the callers
89 responsibility to do this using
\helpref{Unload
}{wxdynamiclibraryunload
}.
92 \membersection{wxDynamicLibrary::GetSymbol
}\label{wxdynamiclibrarygetsymbol
}
94 \constfunc{void *
}{GetSymbol
}{\param{const wxString\&
}{name
}}
96 Returns pointer to symbol
{\it name
} in the library or NULL if the library
97 contains no such symbol.
101 \helpref{wxDYNLIB
\_FUNCTION}{wxdynlibfunction
}
104 \membersection{wxDynamicLibrary::GetSymbolAorW
}\label{wxdynamiclibrarygetsymbolaorw
}
106 \constfunc{void *
}{GetSymbolAorW
}{\param{const wxString\&
}{name
}}
108 This function is available only under Windows as it is only useful when
109 dynamically loading symbols from standard Windows DLLs. Such functions have
110 either
\texttt{'A'
} (in ANSI build) or
\texttt{'W'
} (in Unicode, or wide
111 character build) suffix if they take string parameters. Using this function you
112 can use just the base name of the function and the correct suffix is appende
113 automatically depending on the current build. Otherwise, this method is
114 identical to
\helpref{GetSymbol
}{wxdynamiclibrarygetsymbol
}.
117 \membersection{wxDynamicLibrary::GetProgramHandle
}\label{wxdynamiclibrarygetprogramhandle
}
119 \func{static wxDllType
}{GetProgramHandle
}{\void}
121 Return a valid handle for the main program itself or
\texttt{NULL
} if symbols
122 from the main program can't be loaded on this platform.
125 \membersection{wxDynamicLibrary::HasSymbol
}\label{wxdynamiclibraryhassymbol
}
127 \constfunc{bool
}{HasSymbol
}{\param{const wxString\&
}{name
}}
129 Returns
\true if the symbol with the given
\arg{name
} is present in the dynamic
130 library,
\false otherwise. Unlike
\helpref{GetSymbol
}{wxdynamiclibrarygetsymbol
},
131 this function doesn't log an error message if the symbol is not found.
136 \membersection{wxDynamicLibrary::IsLoaded
}\label{wxdynamiclibraryisloaded
}
138 \constfunc{bool
}{IsLoaded
}{\void}
140 Returns
\true if the library was successfully loaded,
\false otherwise.
143 \membersection{wxDynamicLibrary::ListLoaded
}\label{wxdynamiclibrarylistloaded
}
145 \func{static wxDynamicLibraryDetailsArray
}{ListLoaded
}{\void}
147 This static method returns an
\helpref{array
}{wxarray
} containing the details
148 of all modules loaded into the address space of the current project, the array
149 elements are object of
\texttt{wxDynamicLibraryDetails
} class. The array will
150 be empty if an error occurred.
152 This method is currently implemented only under Win32 and Linux and is useful
153 mostly for diagnostics purposes.
156 \membersection{wxDynamicLibrary::Load
}\label{wxdynamiclibraryload
}
158 \func{bool
}{Load
}{\param{const wxString\&
}{name
},
\param{int
}{flags = wxDL
\_DEFAULT}}
160 Loads DLL with the given
\arg{name
} into memory. The
\arg{flags
} argument can
161 be a combination of the following bits:
164 \twocolitem{wxDL
\_LAZY}{equivalent of RTLD
\_LAZY under Unix, ignored elsewhere
}
165 \twocolitem{wxDL
\_NOW}{equivalent of RTLD
\_NOW under Unix, ignored elsewhere
}
166 \twocolitem{wxDL
\_GLOBAL}{equivalent of RTLD
\_GLOBAL under Unix, ignored elsewhere
}
167 \twocolitem{wxDL
\_VERBATIM}{don't try to append the appropriate extension to
168 the library name (this is done by default).
}
169 \twocolitem{wxDL
\_DEFAULT}{default flags, same as wxDL
\_NOW currently
}
170 \twocolitem{wxDL
\_QUIET}{don't log an error message if the library couldn't be
174 Returns
\true if the library was successfully loaded,
\false otherwise.
177 \membersection{wxDynamicLibrary::Unload
}\label{wxdynamiclibraryunload
}
179 \func{void
}{Unload
}{\void}
181 \func{static void
}{Unload
}{\param{wxDllType
}{handle
}}
183 Unloads the library from memory. wxDynamicLibrary object automatically calls
184 this method from its destructor if it had been successfully loaded.
186 The second version is only used if you need to keep the library in memory
187 during a longer period of time than the scope of the wxDynamicLibrary object.
188 In this case you may call
\helpref{Detach
}{wxdynamiclibrarydetach
} and store
189 the handle somewhere and call this static method later to unload it.
191 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
193 \section{\class{wxDynamicLibraryDetails
}}\label{wxdynamiclibrarydetails
}
195 This class is used for the objects returned by
196 \helpref{wxDynamicLibrary::ListLoaded
}{wxdynamiclibrarylistloaded
} method and
197 contains the information about a single module loaded into the address space of
198 the current process. A module in this context may be either a dynamic library
199 or the main program itself.
201 \wxheading{Derived from
}
205 \wxheading{Include files
}
211 \helpref{wxBase
}{librarieslist
}
213 (only available if
\texttt{wxUSE
\_DYNLIB\_CLASS} is set to $
1$)
215 \latexignore{\rtfignore{\wxheading{Members
}}}
217 \membersection{wxDynamicLibraryDetails::GetName
}\label{wxdynamiclibrarygetname
}
219 \constfunc{wxString
}{GetName
}{\void}
221 Returns the base name of this module, e.g.
\texttt{kernel32.dll
} or
222 \texttt{libc-
2.3.2.so
}.
225 \membersection{wxDynamicLibraryDetails::GetPath
}\label{wxdynamiclibrarygetpath
}
227 \constfunc{wxString
}{GetPath
}{\void}
229 Returns the full path of this module if available, e.g.
230 \texttt{c:$
\backslash$windows$
\backslash$system32$
\backslash$kernel32.dll
} or
231 \texttt{/lib/libc-
2.3.2.so
}.
234 \membersection{wxDynamicLibraryDetails::GetAddress
}\label{wxdynamiclibrarygetaddress
}
236 \constfunc{bool
}{GetAddress
}{\param{void **
}{addr
},
\param{size
\_t }{*len
}}
238 Retrieves the load address and the size of this module.
240 \wxheading{Parameters
}
242 \docparam{addr
}{the pointer to the location to return load address in, may be
245 \docparam{len
}{pointer to the location to return the size of this module in
246 memory in, may be
\texttt{NULL
}}
248 \wxheading{Return value
}
250 \true if the load address and module size were retrieved,
\false if this
251 information is not available.
254 \membersection{wxDynamicLibraryDetails::GetVersion
}\label{wxdynamiclibrarygetversion
}
256 \constfunc{wxString
}{GetVersion
}{\void}
258 Returns the version of this module, e.g.
\texttt{5.2.3790.0} or
259 \texttt{2.3.2}. The returned string is empty if the version information is not