summaryrefslogtreecommitdiff
path: root/cpp/include/Ice/DynamicLibrary.h
blob: a8f3f3f38ed7e8a293362b10999427bb6529558f (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
// **********************************************************************
//
// Copyright (c) 2002
// MutableRealms, Inc.
// Huntsville, AL, USA
//
// All Rights Reserved
//
// **********************************************************************

#ifndef ICE_DYNAMIC_LIBRARY_H
#define ICE_DYNAMIC_LIBRARY_H

#include <Ice/DynamicLibraryF.h>
#include <IceUtil/Shared.h>

namespace IceInternal
{

class DynamicLibrary : public ::IceUtil::Shared
{
public:

    DynamicLibrary();
    ~DynamicLibrary();

    bool load(const std::string&);

#ifdef WIN32
    typedef FARPROC symbol_type;
#else
    typedef void* symbol_type;
#endif

    symbol_type getSymbol(const std::string&); // Returns 0 if no match found

    const std::string& getErrorMessage() const; // Error message for last failure

private:

#ifdef WIN32
    HINSTANCE _hnd;
#else
    void* _hnd;
#endif

    std::string _err;
};

}

#endif