Blender V5.3
dbus_dynload_utils.c
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2026 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
11
12#include <stdio.h>
13
14#include "dbus_dynload_utils.h"
15
17 const int paths_num,
18 const bool verbose,
19 int *r_path_index)
20{
21 DynamicLibrary lib = NULL;
22 for (int a = 0; a < paths_num; a++) {
23 lib = dynamic_library_open(paths[a]);
24 if (lib) {
25 *r_path_index = a;
26 break;
27 }
28 }
29 if (lib == NULL) {
30 /* Use the last path as it's likely to be least specific. */
31 if (verbose) {
32 fprintf(stderr, "Unable to find '%s'\n", paths[paths_num - 1]);
33 }
34 }
35 return lib;
36}
37
39 const char *symbol,
40 const char *path_lib,
41 const bool verbose)
42{
43 void *symbol_var = dynamic_library_find(lib, symbol);
44 if (symbol_var == NULL) {
45 if (verbose) {
46 fprintf(stderr, "Unable to find '%s' in '%s'.\n", symbol, path_lib);
47 }
48 }
49 return symbol_var;
50}
static DynamicLibrary lib
DynamicLibrary dynamic_library_open_array_with_error(const char **paths, const int paths_num, const bool verbose, int *r_path_index)
void * dynamic_library_find_with_error(DynamicLibrary lib, const char *symbol, const char *path_lib, const bool verbose)
void * DynamicLibrary
#define dynamic_library_find(lib, symbol)
#define dynamic_library_open(path)