Skip to content

Commit

Permalink
Protect use of dlopen() with HAVE_DLSYM and HAVE_DLFCN_H for compatib…
Browse files Browse the repository at this point in the history
…ility 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
  • Loading branch information
Manolo Gouy authored and Manolo Gouy committed Oct 1, 2014
1 parent ecbda61 commit 7a609f3
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Fl_Preferences.cxx
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 7a609f3

Please sign in to comment.