Protect use of dlopen() with HAVE_DLSYM and HAVE_DLFCN_H for compatibility with cases where this function is not available.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10350 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy 2014-10-01 17:43:27 +00:00
parent ecbda61220
commit 7a609f3912

View File

@ -40,10 +40,14 @@
#elif defined (__APPLE__)
# include <ApplicationServices/ApplicationServices.h>
# include <unistd.h>
# include <config.h>
# include <dlfcn.h>
#else
# include <unistd.h>
# include <dlfcn.h>
# include <config.h>
# if HAVE_DLFCN_H
# include <dlfcn.h>
# endif
#endif
#ifdef WIN32
@ -1766,7 +1770,10 @@ int Fl_Plugin_Manager::load(const char *filename) {
#if defined(WIN32) && !defined(__CYGWIN__)
HMODULE dl = LoadLibrary(filename);
#else
void * dl = dlopen(filename, RTLD_LAZY);
void * dl = NULL;
# if HAVE_DLSYM
dl = dlopen(filename, RTLD_LAZY);
# endif
#endif
// There is no way of unloading a plugin!
return (dl!=0) ? 0 : -1;