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: wxWidgets 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.
23 %\helpref{wxDllLoader}{wxdllloader}
25 \wxheading{Derived from
}
29 \wxheading{Include files
}
33 (only available if
\texttt{wxUSE
\_DYNLIB\_CLASS} is set to $
1$)
35 \latexignore{\rtfignore{\wxheading{Members
}}}
37 \membersection{wxDynamicLibrary::wxDynamicLibrary
}\label{wxdynamiclibrarywxdynamiclibrary
}
39 \func{}{wxDynamicLibrary
}{\void}
41 \func{}{wxDynamicLibrary
}{\param{const wxString\&
}{name
},
\param{int
}{flags = wxDL
\_DEFAULT}}
43 Constructor. Second form calls
\helpref{Load
}{wxdynamiclibraryload
}.
46 \membersection{wxDynamicLibrary::CanonicalizeName
}\label{wxdynamiclibrarycanonicalizename
}
48 \func{wxString
}{CanonicalizeName
}{\param{const wxString\&
}{name
},
\param{wxDynamicLibraryCategory
}{ cat = wxDL
\_LIBRARY}}
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.
54 The possible values for
\arg{cat
} are:
57 \twocolitem{wxDL
\_LIBRARY}{normal library
}
58 \twocolitem{wxDL
\_MODULE}{a loadable module or plugin
}
63 \helpref{CanonicalizePluginName
}{wxdynamiclibrarycanonicalizepluginname
}
67 \membersection{wxDynamicLibrary::CanonicalizePluginName
}\label{wxdynamiclibrarycanonicalizepluginname
}
69 \func{wxString
}{CanonicalizePluginName
}{\param{const wxString\&
}{name
},
\param{wxPluginCategory
}{ cat = wxDL
\_PLUGIN\_GUI}}
71 This function does the same thing as
72 \helpref{CanonicalizeName
}{wxdynamiclibrarycanonicalizename
} but for wxWidgets
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.
77 The possible values for
\arg{cat
} are:
80 \twocolitem{wxDL
\_PLUGIN\_GUI}{plugin which uses GUI classes (default)
}
81 \twocolitem{wxDL
\_PLUGIN\_BASE}{plugin which only uses wxBase
}
85 \membersection{wxDynamicLibrary::Detach
}\label{wxdynamiclibrarydetach
}
87 \func{wxDllType
}{Detach
}{\void}
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
91 responsability to do this using
\helpref{Unload
}{wxdynamiclibraryunload
}.
94 \membersection{wxDynamicLibrary::GetSymbol
}\label{wxdynamiclibrarygetsymbol
}
96 \constfunc{void *
}{GetSymbol
}{\param{const wxString\&
}{name
}}
98 Returns pointer to symbol
{\it name
} in the library or NULL if the library
99 contains no such symbol.
103 \helpref{wxDYNLIB
\_FUNCTION}{wxdynlibfunction
}
106 \membersection{wxDynamicLibrary::HasSymbol
}\label{wxdynamiclibraryhassymbol
}
108 \constfunc{bool
}{HasSymbol
}{\param{const wxString\&
}{name
}}
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.
117 \membersection{wxDynamicLibrary::IsLoaded
}\label{wxdynamiclibraryisloaded
}
119 \constfunc{bool
}{IsLoaded
}{\void}
121 Returns
\true if the library was successfully loaded,
\false otherwise.
124 \membersection{wxDynamicLibrary::ListLoaded
}\label{wxdynamiclibrarylistloaded
}
126 \func{static wxDynamicLibraryDetailsArray
}{ListLoaded
}{\void}
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.
133 This method is currently implemented only under Win32 and Linux and is useful
134 mostly for diagnostics purposes.
137 \membersection{wxDynamicLibrary::Load
}\label{wxdynamiclibraryload
}
139 \func{bool
}{Load
}{\param{const wxString\&
}{name
},
\param{int
}{flags = wxDL
\_DEFAULT}}
141 Loads DLL with the given
\arg{name
} into memory. The
\arg{flags
} argument can
142 be a combination of the following bits:
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).
}
152 Returns
\true if the library was successfully loaded,
\false otherwise.
155 \membersection{wxDynamicLibrary::Unload
}\label{wxdynamiclibraryunload
}
157 \func{void
}{Unload
}{\void}
159 \func{static void
}{Unload
}{\param{wxDllType
}{handle
}}
161 Unloads the library from memory. wxDynamicLibrary object automatically calls
162 this method from its destructor if it had been successfully loaded.
164 The second version is only used if you need to keep the library in memory
165 during a longer period of time than the scope of the wxDynamicLibrary object.
166 In this case you may call
\helpref{Detach
}{wxdynamiclibrarydetach
} and store
167 the handle somewhere and call this static method later to unload it.
169 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
171 \section{\class{wxDynamicLibraryDetails
}}\label{wxdynamiclibrarydetails
}
173 This class is used for the objects returned by
174 \helpref{wxDynamicLibrary::ListLoaded
}{wxdynamiclibrarylistloaded
} method and
175 contains the information about a single module loaded into the address space of
176 the current process. A module in this context may be either a dynamic library
177 or the main program itself.
179 \wxheading{Derived from
}
183 \wxheading{Include files
}
187 (only available if
\texttt{wxUSE
\_DYNLIB\_CLASS} is set to $
1$)
189 \latexignore{\rtfignore{\wxheading{Members
}}}
191 \membersection{wxDynamicLibraryDetails::GetName
}\label{wxdynamiclibrarygetname
}
193 \constfunc{wxString
}{GetName
}{\void}
195 Returns the base name of this module, e.g.
\texttt{kernel32.dll
} or
196 \texttt{libc-
2.3.2.so
}.
199 \membersection{wxDynamicLibraryDetails::GetPath
}\label{wxdynamiclibrarygetpath
}
201 \constfunc{wxString
}{GetPath
}{\void}
203 Returns the full path of this module if available, e.g.
204 \texttt{c:$
\backslash$windows$
\backslash$system32$
\backslash$kernel32.dll
} or
205 \texttt{/lib/libc-
2.3.2.so
}.
208 \membersection{wxDynamicLibraryDetails::GetAddress
}\label{wxdynamiclibrarygetaddress
}
210 \constfunc{bool
}{GetAddress
}{\param{void **
}{addr
},
\param{size
\_t }{*len
}}
212 Retrieves the load address and the size of this module.
214 \wxheading{Parameters
}
216 \docparam{addr
}{the pointer to the location to return load address in, may be
219 \docparam{len
}{pointer to the location to return the size of this module in
220 memory in, may be
\texttt{NULL
}}
222 \wxheading{Return value
}
224 \true if the load address and module size were retrieved,
\false if this
225 information is not available.
228 \membersection{wxDynamicLibraryDetails::GetVersion
}\label{wxdynamiclibrarygetversion
}
230 \constfunc{wxString
}{GetVersion
}{\void}
232 Returns the version of this module, e.g.
\texttt{5.2.3790.0} or
233 \texttt{2.3.2}. The returned string is empty if the version information is not