blob: 785f32521e4a0a6611acd89d69ed68d15a0da25d (
plain)
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
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup intern_wayland_dynload
*
* Utility defines.
*/
#pragma once
#include <dlfcn.h> /* Dynamic loading. */
#include <stdbool.h>
typedef void *DynamicLibrary;
#define dynamic_library_open(path) dlopen(path, RTLD_NOW)
#define dynamic_library_close(lib) dlclose(lib)
#define dynamic_library_find(lib, symbol) dlsym(lib, symbol)
/** Loads a library from an array, printing an error when the symbol isn't found. */
DynamicLibrary dynamic_library_open_array_with_error(const char **paths,
int paths_num,
bool verbose,
int *r_path_index);
/** Find a symbol, printing an error when the symbol isn't found. */
void *dynamic_library_find_with_error(DynamicLibrary lib,
const char *symbol,
const char *path_lib);
|