Skip to content

Instantly share code, notes, and snippets.

@springmeyer
Created January 17, 2012 13:13
Show Gist options
  • Save springmeyer/1626582 to your computer and use it in GitHub Desktop.
Save springmeyer/1626582 to your computer and use it in GitHub Desktop.
add back ltdl global advise
diff --git a/src/datasource_cache.cpp b/src/datasource_cache.cpp
index dd1721c..c129276 100644
--- a/src/datasource_cache.cpp
+++ b/src/datasource_cache.cpp
@@ -160,11 +160,35 @@ void datasource_cache::register_datasources(const std::string& str)
{
try
{
-#if (BOOST_FILESYSTEM_VERSION == 3)
- lt_dlhandle module = lt_dlopen(itr->path().string().c_str());
+
+ lt_dlerror();
+
+ lt_dlhandle module = 0;
+ lt_dladvise advise;
+ int ret;
+
+ ret = lt_dlinit();
+ if (ret != 0) {
+ std::clog << "Datasource loader: could not intialize dynamic loading: " << lt_dlerror() << "\n";
+ }
+
+ ret = lt_dladvise_init(&advise);
+ if (ret != 0) {
+ std::clog << "Datasource loader: could not intialize dynamic loading: " << lt_dlerror() << "\n";
+ }
+
+ ret = lt_dladvise_global(&advise);
+ if (ret != 0) {
+ std::clog << "Datasource loader: could not intialize dynamic loading of global symbols: " << lt_dlerror() << "\n";
+ }
+#if (BOOST_FILESYSTEM_VERSION == 3)
+ module = lt_dlopenadvise (itr->path().string().c_str(), advise);
#else // v2
- lt_dlhandle module = lt_dlopen(itr->string().c_str());
-#endif
+ module = lt_dlopenadvise (itr->string().c_str(), advise);
+#endif
+
+ lt_dladvise_destroy(&advise);
+
if (module)
{
// http://www.mr-edd.co.uk/blog/supressing_gcc_warnings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment