Blender V4.3
wayland_dynload_egl.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
13#include "wayland_dynload_API.h"
15
16#include "wayland_dynload_egl.h" /* Own include. */
17
18/* Public handle. */
20
22
24{
25 /* Library paths. */
26 const char *paths[] = {
27 "libwayland-egl.so.1",
28 "libwayland-egl.so",
29 };
30 const int paths_num = sizeof(paths) / sizeof(*paths);
31 int path_found = 0;
32 if (!(lib = dynamic_library_open_array_with_error(paths, paths_num, verbose, &path_found))) {
33 return false;
34 }
35 if (atexit(wayland_dynload_egl_exit)) {
36 return false;
37 }
38
39#define WAYLAND_DYNLOAD_FN(symbol) \
40 if (!(wayland_dynload_egl.symbol = dynamic_library_find_with_error( \
41 lib, #symbol, paths[path_found], verbose))) \
42 { \
43 return false; \
44 }
45#include "wayland_dynload_egl.h"
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
63#include "wayland_dynload_egl.h"
64#pragma GCC diagnostic pop
static int verbose
Definition cineonlib.cc:31
#define NULL
bool wayland_dynload_egl_init(const bool verbose)
static DynamicLibrary lib
struct WaylandDynload_EGL wayland_dynload_egl
void wayland_dynload_egl_exit(void)
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)