Blender  V3.3
wayland_dynload_libdecor.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
9 #include <stdlib.h> /* `atexit`. */
10 
11 #include "wayland_dynload_API.h"
12 #include "wayland_dynload_utils.h"
13 
14 #include "wayland_dynload_libdecor.h" /* Own include. */
15 
16 /* Public handle. */
18 
20 
22 {
23  /* Library paths. */
24  const char *paths[] = {
25  "libdecor-0.so.0",
26  "libdecor-0.so",
27  };
28  const int paths_num = sizeof(paths) / sizeof(*paths);
29  int path_index;
30  if (!(lib = dynamic_library_open_array_with_error(paths, paths_num, verbose, &path_index))) {
31  return false;
32  }
33  if (atexit(wayland_dynload_libdecor_exit)) {
34  return false;
35  }
36 
37 #define WAYLAND_DYNLOAD_FN(symbol) \
38  if (!(wayland_dynload_libdecor.symbol = dynamic_library_find_with_error( \
39  lib, #symbol, paths[path_index]))) { \
40  return false; \
41  }
43 #undef WAYLAND_DYNLOAD_FN
44 
45  return true;
46 }
47 
49 {
50  if (lib != NULL) {
51  dynamic_library_close(lib); /* Ignore errors. */
52  lib = NULL;
53  }
54 }
55 
56 /* Validate local signatures against the original header. */
57 #pragma GCC diagnostic push
58 #pragma GCC diagnostic ignored "-Wredundant-decls"
59 #define WAYLAND_DYNLOAD_VALIDATE
61 #pragma GCC diagnostic pop
static int verbose
Definition: cineonlib.c:29
bool wayland_dynload_libdecor_init(const bool verbose)
struct WaylandDynload_Libdecor wayland_dynload_libdecor
void wayland_dynload_libdecor_exit(void)
static DynamicLibrary lib
DynamicLibrary dynamic_library_open_array_with_error(const char **paths, const int paths_num, const bool verbose, int *r_path_index)
#define dynamic_library_close(lib)