From 06907b931859501ae1daf193d1c1576aecda1124 Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Wed, 1 Dec 2010 15:49:02 -0700 Subject: [PATCH] don't try to call any libltdl routines if we're not building the extensions --- libbase/sharedlib.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/libbase/sharedlib.cpp b/libbase/sharedlib.cpp index 1fd7e2dba..9fc46275d 100644 --- a/libbase/sharedlib.cpp +++ b/libbase/sharedlib.cpp @@ -73,11 +73,14 @@ SharedLib::SharedLib(const std::string& filespec, const std::string& envvar) scoped_lock lock(_libMutex); // Initialize libtool's dynamic library loader +#ifdef HAVE_LTDL int errors = lt_dlinit (); if (errors) { log_error (_("Couldn't initialize ltdl: %s"), lt_dlerror()); } - +#else +# warning "libltdl not enabled in build". +#endif std::string pluginsdir; char *env = std::getenv (envvar.c_str()); if (env) { @@ -95,7 +98,11 @@ SharedLib::~SharedLib() bool SharedLib::closeLib() { +#ifdef HAVE_LTDL return lt_dlclose(_dlhandle); +#else + return true; +#endif } bool @@ -111,6 +118,8 @@ SharedLib::openLib (const std::string& filespec) scoped_lock lock(_libMutex); log_debug ("Trying to open shared library \"%s\"", filespec); + +#ifdef HAVE_LTDL _dlhandle = lt_dlopenext (filespec.c_str()); if (_dlhandle == NULL) { @@ -120,6 +129,7 @@ SharedLib::openLib (const std::string& filespec) // Make this module unloadable lt_dlmakeresident(_dlhandle); +#endif log_debug (_("Opened dynamic library \"%s\""), filespec); @@ -136,6 +146,7 @@ SharedLib::getInitEntry (const std::string& symbol) scoped_lock lock(_libMutex); +#ifdef HAVE_LTDL run = lt_dlsym (_dlhandle, symbol.c_str()); if (run == NULL) { @@ -144,6 +155,7 @@ SharedLib::getInitEntry (const std::string& symbol) } else { log_debug (_("Found symbol %s @ %p"), symbol, (void *)run); } +#endif return (initentry*)(run); } @@ -157,7 +169,9 @@ SharedLib::getDllSymbol(const std::string& symbol) scoped_lock lock(_libMutex); +#ifdef HAVE_LTDL run = lt_dlsym (_dlhandle, symbol.c_str()); +#endif /* Realistically, we should never get a valid pointer with a value of 0 -- 2.11.4.GIT