1 karl 1.10 //%2005////////////////////////////////////////////////////////////////////////
|
2 chip 1.1 //
|
3 karl 1.9 // 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.5 // IBM Corp.; EMC Corporation, The Open Group.
|
7 karl 1.9 // 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.10 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
|
11 chip 1.1 //
12 // Permission is hereby granted, free of charge, to any person obtaining a copy
13 // of this software and associated documentation files (the "Software"), to
14 // deal in the Software without restriction, including without limitation the
15 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
16 // sell copies of the Software, and to permit persons to whom the Software is
17 // furnished to do so, subject to the following conditions:
|
18 karl 1.9 //
|
19 chip 1.1 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
20 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
21 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
22 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
23 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
25 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 //
28 //==============================================================================
29 //
30 // Author: Chip Vincent (cvincent@us.ibm.com)
31 //
32 // Modified By:
|
33 gs.keenan 1.11 // Sean Keenan, Hewlett Packard Company <sean.keenan@hp.com>
|
34 chip 1.1 //
35 //%/////////////////////////////////////////////////////////////////////////////
36
37 #include "DynamicLibrary.h"
38
|
39 chip 1.4 #include <Pegasus/Common/InternalException.h>
|
40 chip 1.1
41 #if defined(PEGASUS_OS_TYPE_WINDOWS)
42 # include "DynamicLibraryWindows.cpp"
|
43 kumpf 1.2 #elif defined(PEGASUS_OS_HPUX)
44 # include "DynamicLibraryHPUX.cpp"
|
45 chip 1.1 #elif defined(PEGASUS_OS_TYPE_UNIX)
46 # include "DynamicLibraryUnix.cpp"
|
47 gs.keenan 1.11 #elif defined(PEGASUS_OS_VMS)
48 # include "DynamicLibraryVms.cpp"
|
49 chip 1.1 #else
50 # error "Unsupported platform"
51 #endif
52
53 PEGASUS_NAMESPACE_BEGIN
54
|
55 chip 1.3 DynamicLibrary::DynamicLibrary(void) : _handle(0)
56 {
57 }
58
59 DynamicLibrary::DynamicLibrary(const DynamicLibrary & library) : _handle(0)
60 {
61 _fileName = library._fileName;
62
63 // load the module again, if necessary. this effectively increments the
64 // operating system's reference count for the module.
|
65 chip 1.6 if(library.isLoaded())
|
66 chip 1.3 {
67 load();
68 }
69 }
70
71 DynamicLibrary::DynamicLibrary(const String & fileName) : _fileName(fileName), _handle(0)
72 {
73 }
74
75 DynamicLibrary::~DynamicLibrary(void)
76 {
77 // unload the module, if necessary. this ensures 1) the module is released in the
78 // event the caller did not explicity unload it, and 2) the operating system's
79 // reference count is accurate.
|
80 chip 1.6 if(isLoaded())
|
81 chip 1.3 {
82 unload();
83 }
84 }
85
86 DynamicLibrary & DynamicLibrary::operator=(const DynamicLibrary & library)
87 {
|
88 chip 1.8 //cout << "DynamicLibrary::operator=(const DynamicLibrary &)" << endl;
|
89 chip 1.7
|
90 chip 1.3 if(this == &library)
91 {
92 return(*this);
93 }
94
|
95 chip 1.4 if(isLoaded())
96 {
97 unload();
98 }
99
|
100 chip 1.3 _fileName = library._fileName;
101
102 // load the module again, if necessary. this effectively increments the
103 // operating system's reference count for the module.
|
104 chip 1.4 if(library.isLoaded())
|
105 chip 1.3 {
106 load();
107 }
108
109 return(*this);
110 }
111
112 String DynamicLibrary::getFileName(void) const
113 {
114 return(_fileName);
115 }
116
117 DynamicLibrary::LIBRARY_HANDLE DynamicLibrary::getHandle(void) const
118 {
119 return(_handle);
120 }
121
|
122 chip 1.1 PEGASUS_NAMESPACE_END
|