diff --git a/doc/src/Developer_platform.rst b/doc/src/Developer_platform.rst index 74ad4c1aac..19836b1ff2 100644 --- a/doc/src/Developer_platform.rst +++ b/doc/src/Developer_platform.rst @@ -133,6 +133,9 @@ Dynamically loaded object or library functions .. doxygenfunction:: dlsym :project: progguide +.. doxygenfunction:: dlerror + :project: progguide + Compressed file I/O functions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/platform.cpp b/src/platform.cpp index 1936baaf87..427085a6be 100644 --- a/src/platform.cpp +++ b/src/platform.cpp @@ -507,6 +507,13 @@ void *platform::dlopen(const std::string &fname) return (void *) LoadLibrary(fname.c_str()); } +// return dynamic linker error string + +std::string platform::dlerror() +{ + return ""; +} + // close a shared object int platform::dlclose(void *handle) { @@ -528,6 +535,15 @@ void *platform::dlopen(const std::string &fname) return ::dlopen(fname.c_str(), RTLD_NOW | RTLD_GLOBAL); } +// return dynamic linker error string + +std::string platform::dlerror() +{ + const char *errmesg = ::dlerror(); + if (errmesg) return std::string(errmesg); + else return ""; +} + // close a shared object int platform::dlclose(void *handle) { diff --git a/src/platform.h b/src/platform.h index ef45ceff9b..794fd692b0 100644 --- a/src/platform.h +++ b/src/platform.h @@ -133,6 +133,16 @@ namespace platform { void *dlopen(const std::string &fname); + /*! Obtain error diagnostic info after dynamic linking function calls + * + * Return a human-readable string describing the most recent error that + * occurred when using one of the functions for dynamic loading objects + * the last call to this function. The string is empty, if there was no error. + * + * \return string with error message or empty */ + + std::string dlerror(); + /*! Close a shared object * * This releases the object corresponding to the provided handle.