Skip to content

Commit

Permalink
Use RTLD_DEEPBIND if available.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hans Gaiser committed Jun 28, 2017
1 parent 797e76b commit 4edf0b2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/caffe/util/dynamic_library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@

#ifndef _WIN32
# include "dlfcn.h"
# ifdef RTLD_DEEPBIND
# define CAFFE_DLOPEN_FLAGS (RTLD_LAZY | RTLD_LOCAL | RTLD_DEEPBIND)
# else
# define CAFFE_DLOPEN_FLAGS (RTLD_LAZY | RTLD_LOCAL)
# endif
#else
# include "Windows.h"
#endif
Expand All @@ -17,7 +22,7 @@ namespace caffe {
namespace {
#ifndef _WIN32
void * OpenLibrary(std::string const & name) {
return ::dlopen(name.c_str(), RTLD_LAZY | RTLD_LOCAL);
return ::dlopen(name.c_str(), CAFFE_DLOPEN_FLAGS);
}

bool CloseLibrary(void * handle) {
Expand Down

0 comments on commit 4edf0b2

Please sign in to comment.