19 #include <sys/utsname.h>
32 #if (defined(__GNUC__) || defined(__clang__)) && !defined(__MINGW32__) && !defined(__MINGW64__)
33 #define KVIKIO_EXPORT __attribute__((visibility("default")))
34 #define KVIKIO_HIDDEN __attribute__((visibility("hidden")))
40 #define KVIKIO_STRINGIFY_DETAIL(x) #x
41 #define KVIKIO_STRINGIFY(x) KVIKIO_STRINGIFY_DETAIL(x)
49 void*
load_library(std::string
const& name,
int mode = RTLD_LAZY | RTLD_LOCAL | RTLD_NODELETE);
58 int mode = RTLD_LAZY | RTLD_LOCAL | RTLD_NODELETE);
69 void get_symbol(T& handle,
void* lib, std::string
const& name)
73 handle =
reinterpret_cast<T
>(::dlsym(lib, name.c_str()));
74 char const* err = ::dlerror();
75 if (err !=
nullptr) {
throw std::runtime_error(err); }
bool run_udev_readable() noexcept
检查 /run/udev 是否可读。
void * load_library(std::string const &name, int mode=RTLD_LAZY|RTLD_LOCAL|RTLD_NODELETE)
加载共享库。
void get_symbol(T &handle, void *lib, std::string const &name)
使用 dlsym 获取符号
bool is_running_in_wsl() noexcept
尝试检测是否在适用于 Linux 的 Windows 子系统 (WSL) 中运行