1 karl 1.18 //%2006////////////////////////////////////////////////////////////////////////
|
2 chip 1.1 //
|
3 karl 1.12 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
4 // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
5 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
|
6 karl 1.10 // IBM Corp.; EMC Corporation, The Open Group.
|
7 karl 1.12 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
8 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
|
9 karl 1.13 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
|
11 karl 1.18 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
12 // EMC Corporation; Symantec Corporation; The Open Group.
|
13 chip 1.1 //
14 // Permission is hereby granted, free of charge, to any person obtaining a copy
15 // of this software and associated documentation files (the "Software"), to
16 // deal in the Software without restriction, including without limitation the
17 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
18 // sell copies of the Software, and to permit persons to whom the Software is
19 // furnished to do so, subject to the following conditions:
|
20 karl 1.10 //
|
21 chip 1.1 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
22 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
23 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
24 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
25 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
26 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
27 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30 //==============================================================================
31 //
32 //%/////////////////////////////////////////////////////////////////////////////
33
34 #ifndef Pegasus_DynamicLibrary_h
35 #define Pegasus_DynamicLibrary_h
36
37 #include <Pegasus/Common/Config.h>
|
38 chip 1.7 #include <Pegasus/Common/Exception.h>
|
39 chip 1.1 #include <Pegasus/Common/String.h>
|
40 kumpf 1.22 #include <Pegasus/Common/Mutex.h>
|
41 chip 1.1
42 #include <Pegasus/Common/Linkage.h>
43
|
44 david.dillard 1.17 #if defined(PEGASUS_OS_TYPE_WINDOWS)
|
45 mike 1.19 #include <Pegasus/Common/Network.h>
|
46 chip 1.1 #include <windows.h>
47 #endif
48
49 PEGASUS_NAMESPACE_BEGIN
50
51 class PEGASUS_COMMON_LINKAGE DynamicLibrary
52 {
53 public:
|
54 david.dillard 1.17 #if defined(PEGASUS_OS_TYPE_WINDOWS)
|
55 kumpf 1.23 typedef HMODULE DynamicLibraryHandle;
56 typedef FARPROC DynamicSymbolHandle;
|
57 chuck 1.4 #elif defined(PEGASUS_OS_OS400)
|
58 kumpf 1.23 typedef int DynamicLibraryHandle;
59 typedef void * DynamicSymbolHandle;
|
60 marek 1.20 #else
|
61 kumpf 1.23 typedef void * DynamicLibraryHandle;
62 typedef void * DynamicSymbolHandle;
|
63 chip 1.1 #endif
64
65 public:
|
66 kumpf 1.21 DynamicLibrary();
|
67 chip 1.1 DynamicLibrary(const DynamicLibrary & library);
68 explicit DynamicLibrary(const String & fileName);
|
69 kumpf 1.21 virtual ~DynamicLibrary();
|
70 chip 1.1
71 DynamicLibrary & operator=(const DynamicLibrary & library);
72
|
73 kumpf 1.22 Boolean load();
74 const String& getLoadErrorMessage() const;
75 void unload();
|
76 chip 1.1
|
77 kumpf 1.22 Boolean isLoaded() const;
|
78 chip 1.7
|
79 kumpf 1.21 const String& getFileName() const;
|
80 kumpf 1.23 DynamicSymbolHandle getSymbol(const String & symbolName);
|
81 chip 1.1
82 private:
|
83 kumpf 1.22 Boolean _load();
84 void _unload();
85
|
86 chip 1.1 String _fileName;
|
87 kumpf 1.23 DynamicLibraryHandle _handle;
|
88 kumpf 1.21 String _loadErrorMessage;
|
89 kumpf 1.22 Uint32 _referenceCount;
90 Mutex _loadMutex;
|
91 chip 1.1 };
92
93 PEGASUS_NAMESPACE_END
94
95 #endif
|