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