From a7e0dbd83381377bd05a3fa988511d3713996370 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 16 Oct 2022 02:08:40 +0200 Subject: Refactor xcomposite into abstract capture api Refactor c++ files into c files, more usable --- include/LibraryLoader.hpp | 38 -------------------------------------- 1 file changed, 38 deletions(-) delete mode 100644 include/LibraryLoader.hpp (limited to 'include/LibraryLoader.hpp') diff --git a/include/LibraryLoader.hpp b/include/LibraryLoader.hpp deleted file mode 100644 index 16dc580..0000000 --- a/include/LibraryLoader.hpp +++ /dev/null @@ -1,38 +0,0 @@ -#pragma once - -#include -#include - -typedef struct { - void **func; - const char *name; -} dlsym_assign; - -static void* dlsym_print_fail(void *handle, const char *name, bool required) { - dlerror(); - void *sym = dlsym(handle, name); - char *err_str = dlerror(); - - if(!sym) - fprintf(stderr, "%s: dlsym(handle, \"%s\") failed, error: %s\n", required ? "error" : "warning", name, err_str ? err_str : "(null)"); - - return sym; -} - -/* |dlsyms| should be null terminated */ -static bool dlsym_load_list(void *handle, const dlsym_assign *dlsyms) { - bool success = true; - for(int i = 0; dlsyms[i].func; ++i) { - *dlsyms[i].func = dlsym_print_fail(handle, dlsyms[i].name, true); - if(!*dlsyms[i].func) - success = false; - } - return success; -} - -/* |dlsyms| should be null terminated */ -static void dlsym_load_list_optional(void *handle, const dlsym_assign *dlsyms) { - for(int i = 0; dlsyms[i].func; ++i) { - *dlsyms[i].func = dlsym_print_fail(handle, dlsyms[i].name, false); - } -} \ No newline at end of file -- cgit v1.2.3