4 * Dynamic Link Library abstraction class.
6 * Portable Windows Library
8 * Copyright (c) 1993-1998 Equivalence Pty. Ltd.
10 * The contents of this file are subject to the Mozilla Public License
11 * Version 1.0 (the "License"); you may not use this file except in
12 * compliance with the License. You may obtain a copy of the License at
13 * http://www.mozilla.org/MPL/
15 * Software distributed under the License is distributed on an "AS IS"
16 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17 * the License for the specific language governing rights and limitations
20 * The Original Code is Portable Windows Library.
22 * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
24 * Portions are Copyright (C) 1993 Free Software Foundation, Inc.
25 * All Rights Reserved.
27 * Contributor(s): ______________________________________.
30 * Revision 1.15 2004/02/22 02:38:33 ykiryanov
31 * Removed ifndef BEOS when declaring PDynalink
33 * Revision 1.14 2003/09/17 05:41:58 csoutheren
34 * Removed recursive includes
36 * Revision 1.13 2003/09/17 01:18:02 csoutheren
37 * Removed recursive include file system and removed all references
38 * to deprecated coooperative threading support
40 * Revision 1.12 2003/05/14 00:42:32 rjongbloed
41 * Added missing virtual keyword to PDynaLink functions.
43 * Revision 1.11 2003/01/24 10:21:06 robertj
44 * Fixed issues in RTEMS support, thanks Vladimir Nesic
46 * Revision 1.10 2002/10/10 04:43:43 robertj
47 * VxWorks port, thanks Martijn Roest
49 * Revision 1.9 2002/09/16 01:08:59 robertj
50 * Added #define so can select if #pragma interface/implementation is used on
51 * platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.
53 * Revision 1.8 2001/06/30 06:59:06 yurik
54 * Jac Goudsmit from Be submit these changes 6/28. Implemented by Yuri Kiryanov
56 * Revision 1.7 2001/05/22 12:49:32 robertj
57 * Did some seriously wierd rewrite of platform headers to eliminate the
58 * stupid GNU compiler warning about braces not matching.
60 * Revision 1.6 1999/03/09 02:59:49 robertj
61 * Changed comments to doc++ compatible documentation.
63 * Revision 1.5 1999/02/16 08:07:11 robertj
64 * MSVC 6.0 compatibility changes.
66 * Revision 1.4 1998/09/23 06:20:29 robertj
67 * Added open source copyright license.
69 * Revision 1.3 1997/06/16 13:15:52 robertj
70 * Added function to get a dyna-link libraries name.
72 * Revision 1.2 1997/06/08 04:49:20 robertj
73 * Added DLL file extension string function.
75 * Revision 1.1 1995/03/14 12:44:08 robertj
83 #if !defined(P_VXWORKS) && !defined(P_RTEMS)
89 /**A dynamic link library. This allows the loading at run time of code
90 modules for use by an application.
92 class PDynaLink
: public PObject
94 PCLASSINFO(PDynaLink
, PObject
);
97 /**@name Construction */
99 /**Create a new dyna-link, loading the specified module. The first,
100 parameterless, form does load a library.
103 /**Create a new dyna-link, loading the specified module. The first,
104 parameterless, form does load a library.
107 const PString
& name
/// Name of the dynamically loadable module.
110 /**Destroy the dyna-link, freeing the module.
115 /**@name Load/Unload function */
117 /* Open a new dyna-link, loading the specified module.
120 TRUE if the library was loaded.
123 const PString
& name
/// Name of the dynamically loadable module.
126 /**Close the dyna-link library.
128 virtual void Close();
130 /**Dyna-link module is loaded and may be accessed.
132 virtual BOOL
IsLoaded() const;
134 /**Get the name of the loaded library. If the library is not loaded
135 this may return an empty string.
137 If #full# is TRUE then the full pathname of the library
138 is returned otherwise only the name part is returned.
141 String for the library name.
143 virtual PString
GetName(
144 BOOL full
= FALSE
/// Flag for full or short path name
147 /**Get the extension used by this platform for dynamic link libraries.
150 String for file extension.
152 static PString
GetExtension();
155 /**@name DLL entry point functions */
157 /// Primitive pointer to a function for a dynamic link module.
158 typedef void (*Function
)();
161 /**Get a pointer to the function in the dynamically loadable module.
164 TRUE if function was found.
167 PINDEX index
, /// Ordinal number of the function to get.
168 Function
& func
/// Refrence to point to function to get.
171 /**Get a pointer to the function in the dynamically loadable module.
174 TRUE if function was found.
177 const PString
& name
, /// Name of the function to get.
178 Function
& func
/// Refrence to point to function to get.
183 // Include platform dependent part of class
185 #include "msos/ptlib/dynalink.h"
187 #include "unix/ptlib/dynalink.h"
191 #endif // !defined(__BEOS__) && !defined(P_VXWORKS)
195 // End Of File ///////////////////////////////////////////////////////////////