summaryrefslogtreecommitdiffstats
path: root/src/H5PLpkg.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5PLpkg.h')
-rw-r--r--src/H5PLpkg.h71
1 files changed, 68 insertions, 3 deletions
diff --git a/src/H5PLpkg.h b/src/H5PLpkg.h
index dae4c59..6ab0aa9 100644
--- a/src/H5PLpkg.h
+++ b/src/H5PLpkg.h
@@ -26,6 +26,69 @@
#define MAX_PATH_NUM 16
/****************************/
+/* Macros for supporting
+ * both Windows and Unix */
+/****************************/
+
+/* Handle for dynamic library */
+#ifdef H5_HAVE_WIN32_API
+/* Handle for dynamic library */
+#define H5PL_HANDLE HINSTANCE
+
+/* Get a handle to a plugin library. Windows: TEXT macro handles Unicode strings */
+#define H5PL_OPEN_DLIB(S) LoadLibraryEx(TEXT(S), NULL, LOAD_WITH_ALTERED_SEARCH_PATH)
+
+/* Get the address of a symbol in dynamic library */
+#define H5PL_GET_LIB_FUNC(H,N) GetProcAddress(H,N)
+
+/* Close dynamic library */
+#define H5PL_CLOSE_LIB(H) FreeLibrary(H)
+
+/* Declare error string */
+#define H5PL_ERROR DWORD dw; char *error
+
+/* Clear error - nothing to do */
+#define H5PLG_CLR_ERROR
+
+/* Print error message */
+#define H5PL_CHECK_ERR(R) { \
+ if(R==NULL) { \
+ dw = GetLastError(); \
+ sprintf(error, "%ld", dw); \
+ } \
+ else error = NULL; \
+}
+
+#else
+/* Handle for dynamic library */
+#define H5PL_HANDLE void *
+
+/* Get a handle to a plugin library. Windows: TEXT macro handles Unicode strings */
+#define H5PL_OPEN_DLIB(S) dlopen(S, RTLD_NOW|RTLD_LAZY)
+
+/* Get the address of a symbol in dynamic library */
+#define H5PL_GET_LIB_FUNC(H,N) dlsym(H,N)
+
+/* Close dynamic library */
+#define H5PL_CLOSE_LIB(H) dlclose(H)
+
+/* Declare error string */
+#define H5PL_ERROR char *error
+
+/* Clear error */
+#define H5PL_CLR_ERR dlerror()
+
+/* Print error message */
+#define H5PL_CHECK_ERR(R) { \
+ if(R==NULL) { \
+ error = dlerror(); \
+ } \
+ else error = NULL; \
+}
+
+#endif
+
+/****************************/
/* Local typedefs */
/****************************/
@@ -33,7 +96,7 @@
typedef struct H5PL_table_t {
H5PL_type_t pl_type; /* plugin type */
int pl_id; /* ID for the plugin */
- void *handle; /* plugin handle */
+ H5PL_HANDLE handle; /* plugin handle */
} H5PL_table_t;
/****************************/
@@ -55,8 +118,10 @@ static htri_t path_found = FALSE;
/******************************/
/* Function prototypes for H5PL package scope */
-htri_t H5PL_find(H5PL_type_t plugin_type, int type_id, char *dir, void **info);
-htri_t H5PL_search_table(H5PL_type_t plugin_type, int type_id, void **info);
+H5_DLL htri_t H5PL_find(H5PL_type_t plugin_type, int type_id, char *dir, void **info);
+H5_DLL htri_t H5PL_open(H5PL_type_t pl_type, char *libname, int plugin_id, void **pl_info);
+H5_DLL htri_t H5PL_search_table(H5PL_type_t plugin_type, int type_id, void **info);
+H5_DLL herr_t H5PL_close(H5PL_HANDLE handle);
#endif /* _H5PLpkg_H */