HDF5  1.12.0
H5PLpkg.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2  * Copyright by The HDF Group. *
3  * Copyright by the Board of Trustees of the University of Illinois. *
4  * All rights reserved. *
5  * *
6  * This file is part of HDF5. The full HDF5 copyright notice, including *
7  * terms governing use, modification, and redistribution, is contained in *
8  * the COPYING file, which can be found at the root of the source code *
9  * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
10  * If you do not have access to either file, you may request a copy from *
11  * help@hdfgroup.org. *
12  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
13 
14 /*
15  * Purpose: This file contains declarations which are visible only within
16  * the H5PL package. Source files outside the H5PL package should
17  * include H5PLprivate.h instead.
18  */
19 
20 #if !(defined H5PL_FRIEND || defined H5PL_MODULE)
21 #error "Do not include this file outside the H5PL package!"
22 #endif
23 
24 #ifndef _H5PLpkg_H
25 #define _H5PLpkg_H
26 
27 /* Include private header file */
28 #include "H5PLprivate.h" /* Filter functions */
29 
30 /* Other private headers needed by this file */
31 
32 /**************************/
33 /* Package Private Macros */
34 /**************************/
35 
36 /* Whether to pre-load pathnames for plugin libraries */
37 #define H5PL_DEFAULT_PATH H5_DEFAULT_PLUGINDIR
38 
39 
40 /****************************/
41 /* Macros for supporting */
42 /* both Windows and POSIX */
43 /****************************/
44 
45 /*******************/
46 /* Windows support */
47 /*******************/
48 /*
49  * SPECIAL WINDOWS NOTE
50  *
51  * Some of the Win32 API functions expand to fooA or fooW depending on
52  * whether UNICODE or _UNICODE are defined. You MUST explicitly use
53  * the A version of the functions to force char * behavior until we
54  * work out a scheme for proper Windows Unicode support.
55  *
56  * If you do not do this, people will be unable to incorporate our
57  * source code into their own CMake builds if they define UNICODE.
58  */
59 #ifdef H5_HAVE_WIN32_API
60 
61  /* The path separator on this platform */
62 # define H5PL_PATH_SEPARATOR ";"
63 
64  /* Handle for dynamic library */
65 # define H5PL_HANDLE HINSTANCE
66 
67  /* Get a handle to a plugin library. Windows: TEXT macro handles Unicode strings */
68 # define H5PL_OPEN_DLIB(S) LoadLibraryExA(S, NULL, LOAD_WITH_ALTERED_SEARCH_PATH)
69 
70  /* Get the address of a symbol in dynamic library */
71 # define H5PL_GET_LIB_FUNC(H,N) GetProcAddress(H,N)
72 
73  /* Close dynamic library */
74 # define H5PL_CLOSE_LIB(H) FreeLibrary(H)
75 
76  /* Clear error - nothing to do */
77 # define H5PL_CLR_ERROR
78 
79  /* maximum size for expanding env vars */
80 # define H5PL_EXPAND_BUFFER_SIZE 32767
81 
82  typedef H5PL_type_t(__cdecl *H5PL_get_plugin_type_t)(void);
83  typedef const void *(__cdecl *H5PL_get_plugin_info_t)(void);
84 
85 #else /* H5_HAVE_WIN32_API */
86 
87  /*****************/
88  /* POSIX support */
89  /*****************/
90 
91  /* The path separator on this platform */
92 # define H5PL_PATH_SEPARATOR ":"
93 
94  /* Handle for dynamic library */
95 # define H5PL_HANDLE void *
96 
97  /* Get a handle to a plugin library. Windows: TEXT macro handles Unicode strings */
98 # define H5PL_OPEN_DLIB(S) dlopen(S, RTLD_LAZY)
99 
100  /* Get the address of a symbol in dynamic library */
101 # define H5PL_GET_LIB_FUNC(H,N) dlsym(H,N)
102 
103  /* Close dynamic library */
104 # define H5PL_CLOSE_LIB(H) dlclose(H)
105 
106  /* Clear error */
107 # define H5PL_CLR_ERROR HERROR(H5E_PLUGIN, H5E_CANTGET, "can't dlopen:%s", dlerror())
108 
110  typedef const void *(*H5PL_get_plugin_info_t)(void);
111 #endif /* H5_HAVE_WIN32_API */
112 
113 
114 /****************************/
115 /* Package Private Typedefs */
116 /****************************/
117 
118 /* Data used to search for plugins */
119 typedef struct H5PL_search_params_t {
121  const H5PL_key_t *key;
123 
124 
125 /*****************************/
126 /* Package Private Variables */
127 /*****************************/
128 
129 
130 /******************************/
131 /* Package Private Prototypes */
132 /******************************/
133 
134 /* Accessors to global variables and flags */
135 H5_DLL herr_t H5PL__get_plugin_control_mask(unsigned int *mask /*out*/);
136 H5_DLL herr_t H5PL__set_plugin_control_mask(unsigned int mask);
137 
138 /* Plugin search and manipulation */
139 H5_DLL herr_t H5PL__open(const char *libname, H5PL_type_t type, const H5PL_key_t *key,
140  hbool_t *success /*out*/, const void **plugin_info /*out*/);
142 
143 /* Plugin cache calls */
145 H5_DLL herr_t H5PL__close_plugin_cache(hbool_t *already_closed /*out*/);
147  H5PL_HANDLE handle);
148 H5_DLL herr_t H5PL__find_plugin_in_cache(const H5PL_search_params_t *search_params, hbool_t *found /*out*/, const void **plugin_info /*out*/);
149 
150 /* Plugin search path calls */
153 H5_DLL unsigned H5PL__get_num_paths(void);
154 H5_DLL herr_t H5PL__append_path(const char *path);
155 H5_DLL herr_t H5PL__prepend_path(const char *path);
156 H5_DLL herr_t H5PL__replace_path(const char *path, unsigned int index);
157 H5_DLL herr_t H5PL__insert_path(const char *path, unsigned int index);
158 H5_DLL herr_t H5PL__remove_path(unsigned int index);
159 H5_DLL const char *H5PL__get_path(unsigned int index);
160 H5_DLL herr_t H5PL__find_plugin_in_path_table(const H5PL_search_params_t *search_params, hbool_t *found /*out*/, const void **plugin_info /*out*/);
161 
162 #endif /* _H5PLpkg_H */
163 
H5PL_type_t
H5PL_type_t
Definition: H5PLpublic.h:32
H5PL_get_plugin_info_t
const void *(* H5PL_get_plugin_info_t)(void)
Definition: H5PLpkg.h:110
H5PL__get_num_paths
H5_DLL unsigned H5PL__get_num_paths(void)
Definition: H5PLpath.c:339
H5PL__find_plugin_in_path_table
H5_DLL herr_t H5PL__find_plugin_in_path_table(const H5PL_search_params_t *search_params, hbool_t *found, const void **plugin_info)
Definition: H5PLpath.c:583
H5PL_search_params_t::type
H5PL_type_t type
Definition: H5PLpkg.h:120
H5PL__append_path
H5_DLL herr_t H5PL__append_path(const char *path)
Definition: H5PLpath.c:393
H5PL_search_params_t
Definition: H5PLpkg.h:119
H5PL_get_plugin_type_t
H5PL_type_t(* H5PL_get_plugin_type_t)(void)
Definition: H5PLpkg.h:109
path
H5T_path_t ** path
Definition: H5T.c:558
H5PL_search_params_t::key
const H5PL_key_t * key
Definition: H5PLpkg.h:121
H5PL_HANDLE
#define H5PL_HANDLE
Definition: H5PLpkg.h:95
H5PL__close_plugin_cache
H5_DLL herr_t H5PL__close_plugin_cache(hbool_t *already_closed)
Definition: H5PLplugin_cache.c:145
H5PLprivate.h
H5PL__add_plugin
H5_DLL herr_t H5PL__add_plugin(H5PL_type_t type, const H5PL_key_t *key, H5PL_HANDLE handle)
Definition: H5PLplugin_cache.c:219
H5PL__prepend_path
H5_DLL herr_t H5PL__prepend_path(const char *path)
Definition: H5PLpath.c:422
H5PL__get_path
H5_DLL const char * H5PL__get_path(unsigned int index)
Definition: H5PLpath.c:554
H5PL__find_plugin_in_cache
H5_DLL herr_t H5PL__find_plugin_in_cache(const H5PL_search_params_t *search_params, hbool_t *found, const void **plugin_info)
Definition: H5PLplugin_cache.c:258
H5PL__close
H5_DLL herr_t H5PL__close(H5PL_HANDLE handle)
Definition: H5PLint.c:432
H5PL__create_plugin_cache
H5_DLL herr_t H5PL__create_plugin_cache(void)
Definition: H5PLplugin_cache.c:108
H5PL__create_path_table
H5_DLL herr_t H5PL__create_path_table(void)
Definition: H5PLpath.c:238
H5PL_key_t
Definition: H5PLprivate.h:38
H5PL__set_plugin_control_mask
H5_DLL herr_t H5PL__set_plugin_control_mask(unsigned int mask)
Definition: H5PLint.c:118
H5_DLL
#define H5_DLL
Definition: H5api_adpt.h:234
H5PL_search_params_t
struct H5PL_search_params_t H5PL_search_params_t
H5PL__get_plugin_control_mask
H5_DLL herr_t H5PL__get_plugin_control_mask(unsigned int *mask)
Definition: H5PLint.c:91
H5PL__insert_path
H5_DLL herr_t H5PL__insert_path(const char *path, unsigned int index)
Definition: H5PLpath.c:482
herr_t
int herr_t
Definition: H5public.h:128
hbool_t
bool hbool_t
Definition: H5public.h:159
H5PL__remove_path
H5_DLL herr_t H5PL__remove_path(unsigned int index)
Definition: H5PLpath.c:513
H5PL__open
H5_DLL herr_t H5PL__open(const char *libname, H5PL_type_t type, const H5PL_key_t *key, hbool_t *success, const void **plugin_info)
Definition: H5PLint.c:309
H5PL__close_path_table
H5_DLL herr_t H5PL__close_path_table(void)
Definition: H5PLpath.c:306
H5PL__replace_path
H5_DLL herr_t H5PL__replace_path(const char *path, unsigned int index)
Definition: H5PLpath.c:451