aboutsummaryrefslogtreecommitdiff
path: root/include/library_loader.h
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2023-04-07 05:31:46 +0200
committerdec05eba <dec05eba@protonmail.com>2023-04-07 05:31:46 +0200
commit75ed160122bc923731ae1d005d789608a4cdb2fb (patch)
tree97a07ea8aaeb23cc8b2f94e11da7ebf703fbc3a3 /include/library_loader.h
parent10d7bf93e864fc6b3c83ad7a913ea05d39256c03 (diff)
Implement kms vaapi capture
Diffstat (limited to 'include/library_loader.h')
-rw-r--r--include/library_loader.h31
1 files changed, 3 insertions, 28 deletions
diff --git a/include/library_loader.h b/include/library_loader.h
index 1622521..47bc9f0 100644
--- a/include/library_loader.h
+++ b/include/library_loader.h
@@ -1,42 +1,17 @@
#ifndef GSR_LIBRARY_LOADER_H
#define GSR_LIBRARY_LOADER_H
-#include <dlfcn.h>
#include <stdbool.h>
-#include <stdio.h>
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;
-}
-
+void* dlsym_print_fail(void *handle, const char *name, bool required);
/* |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;
-}
-
+bool dlsym_load_list(void *handle, const dlsym_assign *dlsyms);
/* |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);
- }
-}
+void dlsym_load_list_optional(void *handle, const dlsym_assign *dlsyms);
#endif /* GSR_LIBRARY_LOADER_H */