forked from awwit/httpserver
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModule.h
More file actions
58 lines (47 loc) · 1007 Bytes
/
Module.h
File metadata and controls
58 lines (47 loc) · 1007 Bytes
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
#pragma once
#ifdef WIN32
#include <windows.h>
#elif POSIX
#include <dlfcn.h>
#else
#error "Undefine platform"
#endif
#include <string>
namespace HttpServer
{
class Module
{
protected:
#ifdef WIN32
::HMODULE lib_handle;
#elif POSIX
void *lib_handle;
#else
#error "Undefine platform"
#endif
public:
Module();
Module(const std::string &libPath);
Module(const Module &obj);
Module(Module &&obj);
~Module() = default;
inline bool is_open() const
{
return nullptr != lib_handle;
}
bool open(const std::string &libPath);
void close();
bool find(const std::string &symbolName, void *(**addr)(void *) ) const;
bool find(const char *symbolName, void *(**addr)(void *) ) const;
inline bool operator ==(const Module &obj) const
{
return lib_handle == obj.lib_handle;
}
inline bool operator !=(const Module &obj) const
{
return lib_handle != obj.lib_handle;
}
Module &operator =(const Module &obj);
Module &operator =(Module &&obj);
};
};