PTLib  Version 2.12.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
dynalink.h
Go to the documentation of this file.
1 /*
2  * dynalink.h
3  *
4  * Dynamic Link Library abstraction class.
5  *
6  * Portable Windows Library
7  *
8  * Copyright (c) 1993-1998 Equivalence Pty. Ltd.
9  *
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/
14  *
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
18  * under the License.
19  *
20  * The Original Code is Portable Windows Library.
21  *
22  * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
23  *
24  * Portions are Copyright (C) 1993 Free Software Foundation, Inc.
25  * All Rights Reserved.
26  *
27  * Contributor(s): ______________________________________.
28  *
29  * $Revision: 24177 $
30  * $Author: rjongbloed $
31  * $Date: 2010-04-05 21:52:04 +1000 (Mon, 05 Apr 2010) $
32  */
33 
34 #ifndef PTLIB_DYNALINK_H
35 #define PTLIB_DYNALINK_H
36 
37 #if !defined(P_RTEMS)
38 
39 #ifdef P_USE_PRAGMA
40 #pragma interface
41 #endif
42 
51 class PDynaLink : public PObject
52 {
53  PCLASSINFO(PDynaLink, PObject);
54 
55  public:
61  PDynaLink();
65  PDynaLink(
66  const PString & name
67  );
68 
71  ~PDynaLink();
73 
76  /* Open a new dyna-link, loading the specified module.
77 
78  @return
79  true if the library was loaded.
80  */
81  virtual PBoolean Open(
82  const PString & name
83  );
84 
87  virtual void Close();
88 
91  virtual PBoolean IsLoaded() const;
92 
102  virtual PString GetName(
103  PBoolean full = false
104  ) const;
105 
111  static PString GetExtension();
113 
116 
117  typedef void (*Function)();
118 
119 
126  PINDEX index,
127  Function & func
128  );
129 
136  const PString & name,
137  Function & func
138  );
139 
141  const PString & GetLastError() const { return m_lastError; }
143 
144  protected:
146 
147 // Include platform dependent part of class
148 #ifdef _WIN32
149 #include "msos/ptlib/dynalink.h"
150 #else
151 #include "unix/ptlib/dynalink.h"
152 #endif
153 };
154 
155 #endif // !defined(P_RTEMS)
156 
157 
158 #endif //PTLIB_DYNALINK_H
159 
160 
161 // End Of File ///////////////////////////////////////////////////////////////