blob: 81b21c8e7991ca9126bb873d106983eed651a903 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
// **********************************************************************
//
// Copyright (c) 2003-2006 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
#ifndef ICE_DYNAMIC_LIBRARY_H
#define ICE_DYNAMIC_LIBRARY_H
#include <Ice/DynamicLibraryF.h>
#include <IceUtil/Shared.h>
namespace IceInternal
{
class ICE_API DynamicLibrary : public ::IceUtil::Shared
{
public:
DynamicLibrary();
~DynamicLibrary();
#ifdef _WIN32
typedef FARPROC symbol_type;
#else
typedef void* symbol_type;
#endif
//
// Load an entry point. This is really a convenience function
// which combines calls to load() and getSymbol(). However, it
// does add some value.
//
// An entry point has the following format:
//
// name[,version]:function
//
// The name of the library is constructed from the given
// information. If no version is supplied and the boolean
// argument is true, the Ice version (10 * major + minor) is
// used instead.
//
// For example, consider the following entry point:
//
// foo:create
//
// This would result in libfoo.so.11 (Unix) and foo11.dll
// (Windows), where the Ice version is 1.1.x.
//
// Now consider this entry point:
//
// foo,12:create
//
// The library names in this case are libfoo.so.12 (Unix) and
// foo12.dll (Windows).
//
// On Windows platforms, a 'd' is appended to the version for
// debug builds.
//
// Returns 0 if a failure occurred.
//
symbol_type loadEntryPoint(const std::string&, bool = true);
//
// Open a library with the given path.
//
bool load(const std::string&);
//
// Retrieve a symbol from the library. Returns 0 if no match is found.
//
symbol_type getSymbol(const std::string&);
//
// Get the error message for the last failure.
//
const std::string& getErrorMessage() const;
private:
#ifdef _WIN32
HINSTANCE _hnd;
#else
void* _hnd;
#endif
std::string _err;
};
class ICE_API DynamicLibraryList : public ::IceUtil::Shared
{
public:
void add(const DynamicLibraryPtr&);
private:
std::vector<DynamicLibraryPtr> _libraries;
};
}
#endif
|