uvw
2.12.1
Loading...
Searching...
No Matches
src
uvw
lib.h
1
#ifndef UVW_LIB_INCLUDE_H
2
#define UVW_LIB_INCLUDE_H
3
4
#include <memory>
5
#include <string>
6
#include <type_traits>
7
#include <uv.h>
8
#include "loop.h"
9
#include "underlying_type.hpp"
10
11
namespace
uvw
{
12
19
class
SharedLib final:
public
UnderlyingType<SharedLib, uv_lib_t> {
20
public
:
21
explicit
SharedLib(ConstructorAccess ca, std::shared_ptr<Loop> ref,
const
std::string &filename)
noexcept
;
22
23
~SharedLib()
noexcept
;
24
29
explicit
operator
bool() const noexcept;
30
40
template<typename F>
41
F *
sym
(const std::
string
&name) {
42
static_assert
(std::is_function_v<F>);
43
F *func;
44
auto
err = uv_dlsym(get(), name.data(),
reinterpret_cast<
void
**
>
(&func));
45
if
(err) { func =
nullptr
; }
46
return
func;
47
}
48
53
const
char
*
error
() const noexcept;
54
55
private:
56
bool
opened;
57
};
58
59
}
// namespace uvw
60
61
#ifndef UVW_AS_LIB
62
# include "lib.cpp"
63
#endif
64
65
#endif
// UVW_LIB_INCLUDE_H
uvw::SharedLib::sym
F * sym(const std::string &name)
Retrieves a data pointer from a dynamic library.
Definition
lib.h:41
uvw::SharedLib::error
const char * error() const noexcept
Returns the last error message, if any.
uvw
uvw default namespace.
Definition
async.h:8
Generated by
1.13.2