/* This file is part of Metaproxy.
- Copyright (C) 2005-2013 Index Data
+ Copyright (C) Index Data
Metaproxy is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
return (it->second());
}
-bool mp::FactoryFilter::have_dl_support()
-{
-#if HAVE_DLFCN_H
- return true;
-#else
- return false;
-#endif
-}
-
bool mp::FactoryFilter::add_creator_dl(const std::string &fi,
const std::string &path)
{
{
return true;
}
-
- std::string full_path = path + "/metaproxy_filter_" + fi + ".so";
- void *dl_handle = dlopen(full_path.c_str(), RTLD_GLOBAL|RTLD_NOW);
- if (!dl_handle)
- {
- const char *dl = dlerror();
- std::cout << "dlopen " << full_path << " failed. dlerror=" << dl <<
- std::endl;
- return false;
- }
-
std::string full_name = "metaproxy_1_filter_" + fi;
+ void *dl_handle = dlopen(0, RTLD_GLOBAL|RTLD_NOW);
void *dlsym_ptr = dlsym(dl_handle, full_name.c_str());
+
+ if (!dlsym_ptr)
+ {
+ std::string full_path = path + "/metaproxy_filter_" + fi + ".so";
+ dl_handle = dlopen(full_path.c_str(), RTLD_GLOBAL|RTLD_NOW);
+ if (!dl_handle)
+ {
+ const char *dl = dlerror();
+ std::cout << "dlopen " << full_path << " failed. dlerror=" << dl <<
+ std::endl;
+ return false;
+ }
+ dlsym_ptr = dlsym(dl_handle, full_name.c_str());
+ }
if (!dlsym_ptr)
{
std::cout << "dlsym " << full_name << " failed\n";