Blender  V3.3
wayland_dynload_cursor.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
9 #include <stdlib.h> /* `atexit`. */
10 #include <string.h>
11 
12 #include "wayland_dynload_API.h"
13 #include "wayland_dynload_utils.h"
14 
15 #include "wayland_dynload_cursor.h" /* Own include. */
16 
18 
20 
22 {
23  /* Library paths. */
24  const char *paths[] = {
25  "libwayland-cursor.so.0",
26  "libwayland-cursor.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_cursor_exit)) {
34  return false;
35  }
36 
37 #define WAYLAND_DYNLOAD_FN(symbol) \
38  if (!(wayland_dynload_cursor.symbol = dynamic_library_find_with_error( \
39  lib, #symbol, paths[path_index]))) { \
40  return false; \
41  }
42 #include "wayland_dynload_cursor.h"
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
60 #include "wayland_dynload_cursor.h"
61 #pragma GCC diagnostic pop
static int verbose
Definition: cineonlib.c:29
bool wayland_dynload_cursor_init(const bool verbose)
struct WaylandDynload_Cursor wayland_dynload_cursor
void wayland_dynload_cursor_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)