]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/dynlib.tex
Correct typos, minor wording improvements
[wxWidgets.git] / docs / latex / wx / dynlib.tex
CommitLineData
f3845e88
VZ
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%% Name: dynlib.tex
3%% Purpose: wxDynamicLibrary documentation
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
fc2171bd 9%% License: wxWidgets 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
f3845e88 25
a018a119 26
f3845e88
VZ
27\membersection{wxDynamicLibrary::wxDynamicLibrary}\label{wxdynamiclibrarywxdynamiclibrary}
28
29\func{}{wxDynamicLibrary}{\void}
30
169948a0 31\func{}{wxDynamicLibrary}{\param{const wxString\& }{name}, \param{int }{flags = wxDL\_DEFAULT}}
f3845e88
VZ
32
33Constructor. Second form calls \helpref{Load}{wxdynamiclibraryload}.
34
a018a119 35
169948a0
VZ
36\membersection{wxDynamicLibrary::CanonicalizeName}\label{wxdynamiclibrarycanonicalizename}
37
5bb31e35 38\func{wxString}{CanonicalizeName}{\param{const wxString\& }{name}, \param{wxDynamicLibraryCategory}{ cat = wxDL\_LIBRARY}}
169948a0
VZ
39
40Returns the platform-specific full name for the library called \arg{name}. E.g.
41it adds a {\tt ".dll"} extension under Windows and {\tt "lib"} prefix and
42{\tt ".so"}, {\tt ".sl"} or maybe {\tt ".dylib"} extension under Unix.
43
44The possible values for \arg{cat} are:
5bb31e35 45
169948a0
VZ
46\begin{twocollist}
47 \twocolitem{wxDL\_LIBRARY}{normal library}
48 \twocolitem{wxDL\_MODULE}{a loadable module or plugin}
49\end{twocollist}
50
51\wxheading{See also}
52
53\helpref{CanonicalizePluginName}{wxdynamiclibrarycanonicalizepluginname}
54
55
a018a119 56
169948a0
VZ
57\membersection{wxDynamicLibrary::CanonicalizePluginName}\label{wxdynamiclibrarycanonicalizepluginname}
58
5bb31e35 59\func{wxString}{CanonicalizePluginName}{\param{const wxString\& }{name}, \param{wxPluginCategory}{ cat = wxDL\_PLUGIN\_GUI}}
169948a0
VZ
60
61This function does the same thing as
fc2171bd 62\helpref{CanonicalizeName}{wxdynamiclibrarycanonicalizename} but for wxWidgets
169948a0
VZ
63plugins. The only difference is that compiler and version information are added
64to the name to ensure that the plugin which is going to be loaded will be
65compatible with the main program.
66
67The possible values for \arg{cat} are:
5bb31e35 68
169948a0
VZ
69\begin{twocollist}
70 \twocolitem{wxDL\_PLUGIN\_GUI}{plugin which uses GUI classes (default)}
71 \twocolitem{wxDL\_PLUGIN\_BASE}{plugin which only uses wxBase}
72\end{twocollist}
73
a018a119 74
9ae2ec95
VZ
75\membersection{wxDynamicLibrary::Detach}\label{wxdynamiclibrarydetach}
76
77\func{wxDllType}{Detach}{\void}
78
79Detaches this object from its library handle, i.e. the object will not unload
80the library any longer in its destructor but it is now the callers
169948a0
VZ
81responsability to do this using \helpref{Unload}{wxdynamiclibraryunload}.
82
a018a119 83
169948a0
VZ
84\membersection{wxDynamicLibrary::GetSymbol}\label{wxdynamiclibrarygetsymbol}
85
a018a119 86\constfunc{void *}{GetSymbol}{\param{const wxString\& }{name}}
169948a0
VZ
87
88Returns pointer to symbol {\it name} in the library or NULL if the library
89contains no such symbol.
90
91\wxheading{See also}
92
93\helpref{wxDYNLIB\_FUNCTION}{wxdynlibfunction}
94
a018a119
VZ
95
96\membersection{wxDynamicLibrary::HasSymbol}\label{wxdynamiclibraryhassymbol}
97
98\constfunc{bool}{HasSymbol}{\param{const wxString\& }{name}}
99
100Returns \true if the symbol with the given \arg{name} is present in the dynamic
101library, \false otherwise. Unlike \helpref{GetSymbol}{wxdynamiclibrarygetsymbol},
102this function doesn't log an error message if the symbol is not found.
103
104\newsince{2.5.4}
105
106
f3845e88
VZ
107\membersection{wxDynamicLibrary::IsLoaded}\label{wxdynamiclibraryisloaded}
108
109\constfunc{bool}{IsLoaded}{\void}
110
169948a0
VZ
111Returns \true if the library was successfully loaded, \false otherwise.
112
a018a119 113
f3845e88
VZ
114\membersection{wxDynamicLibrary::Load}\label{wxdynamiclibraryload}
115
169948a0 116\func{bool}{Load}{\param{const wxString\& }{name}, \param{int }{flags = wxDL\_DEFAULT}}
f3845e88 117
169948a0
VZ
118Loads DLL with the given \arg{name} into memory. The \arg{flags} argument can
119be a combination of the following bits:
d2c2afc9 120
169948a0
VZ
121\begin{twocollist}
122\twocolitem{wxDL\_LAZY}{equivalent of RTLD\_LAZY under Unix, ignored elsewhere}
123\twocolitem{wxDL\_NOW}{equivalent of RTLD\_NOW under Unix, ignored elsewhere}
124\twocolitem{wxDL\_GLOBAL}{equivalent of RTLD\_GLOBAL under Unix, ignored elsewhere}
125\twocolitem{wxDL\_VERBATIM}{don't try to append the appropriate extension to
126the library name (this is done by default).}
127\end{twocollist}
f3845e88 128
169948a0 129Returns \true if the library was successfully loaded, \false otherwise.
f3845e88 130
a018a119 131
169948a0 132\membersection{wxDynamicLibrary::Unload}\label{wxdynamiclibraryunload}
f3845e88 133
169948a0 134\func{void}{Unload}{\void}
f3845e88 135
169948a0 136\func{static void}{Unload}{\param{wxDllType }{handle}}
f3845e88 137
169948a0
VZ
138Unloads the library from memory. wxDynamicLibrary object automatically calls
139this method from its destructor if it had been successfully loaded.
4104ed92 140
169948a0
VZ
141The second version is only used if you need to keep the library in memory
142during a longer period of time than the scope of the wxDynamicLibrary object.
143In this case you may call \helpref{Detach}{wxdynamiclibrarydetach} and store
144the handle somewhere and call this static method later to unload it.
f3845e88 145