BRL-CAD
dylib.h
Go to the documentation of this file.
1/* D Y L I B. H
2 * BRL-CAD
3 *
4 * Copyright (c) 2004-2023 United States Government as represented by
5 * the U.S. Army Research Laboratory.
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public License
9 * version 2.1 as published by the Free Software Foundation.
10 *
11 * This library is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this file; see the file named COPYING for more
18 * information.
19 */
20
21#ifndef BU_DYLIB_H
22#define BU_DYLIB_H
23
24#include "common.h"
25
26#ifdef HAVE_DLFCN_H
27# include <dlfcn.h> /* for RTLD_* */
28#endif
29
30#include "bu/defines.h"
31
32
33__BEGIN_DECLS
34
35
36/**
37 * @addtogroup bu_dylib
38 *
39 * @brief Dynamic Library functionality
40 */
41/** @{ */
42
43#ifdef HAVE_DLOPEN
44# define BU_RTLD_LAZY RTLD_LAZY
45# define BU_RTLD_NOW RTLD_NOW
46# define BU_RTLD_GLOBAL RTLD_GLOBAL
47# define BU_RTLD_LOCAL RTLD_LOCAL
48#else
49# define BU_RTLD_LAZY 1
50# define BU_RTLD_NOW 2
51# define BU_RTLD_GLOBAL 0x100
52# define BU_RTLD_LOCAL 0
53#endif
54
55
56BU_EXPORT extern void *bu_dlopen(const char *path, int mode);
57BU_EXPORT extern void *bu_dlsym(void *path, const char *symbol);
58BU_EXPORT extern int bu_dlclose(void *handle);
59BU_EXPORT extern const char *bu_dlerror(void);
60BU_EXPORT extern int bu_dlunload(void);
61
62/** @} */
63
64__END_DECLS
65
66#endif /* BU_DYLIB_H */
67
68/*
69 * Local Variables:
70 * mode: C
71 * tab-width: 8
72 * indent-tabs-mode: t
73 * c-file-style: "stroustrup"
74 * End:
75 * ex: shiftwidth=4 tabstop=8
76 */
Header file for the BRL-CAD common definitions.
void * bu_dlopen(const char *path, int mode)
int bu_dlunload(void)
int bu_dlclose(void *handle)
const char * bu_dlerror(void)
void * bu_dlsym(void *path, const char *symbol)
void int char * mode
Definition: tig.h:179