Blender V4.3
wayland_dynload_cursor.c
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2022 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
11#include <stdlib.h> /* `atexit`. */
12#include <string.h>
13
14#include "wayland_dynload_API.h"
16
17#include "wayland_dynload_cursor.h" /* Own include. */
18
20
22
24{
25 /* Library paths. */
26 const char *paths[] = {
27 "libwayland-cursor.so.0",
28 "libwayland-cursor.so",
29 };
30 const int paths_num = sizeof(paths) / sizeof(*paths);
31 int path_index;
32 if (!(lib = dynamic_library_open_array_with_error(paths, paths_num, verbose, &path_index))) {
33 return false;
34 }
35 if (atexit(wayland_dynload_cursor_exit)) {
36 return false;
37 }
38
39#define WAYLAND_DYNLOAD_FN(symbol) \
40 if (!(wayland_dynload_cursor.symbol = dynamic_library_find_with_error( \
41 lib, #symbol, paths[path_index], verbose))) \
42 { \
43 return false; \
44 }
46#undef WAYLAND_DYNLOAD_FN
47
48 return true;
49}
50
52{
53 if (lib != NULL) {
54 dynamic_library_close(lib); /* Ignore errors. */
55 lib = NULL;
56 }
57}
58
59/* Validate local signatures against the original header. */
60#pragma GCC diagnostic push
61#pragma GCC diagnostic ignored "-Wredundant-decls"
62#define WAYLAND_DYNLOAD_VALIDATE
64#pragma GCC diagnostic pop
static int verbose
Definition cineonlib.cc:31
#define NULL
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)