# Dependencies
SET(DEPS
+ gmodule-2.0
vconf
capi-system-info
capi-system-device
ENDFOREACH(flag)
ADD_EXECUTABLE(${target} ${SRCS})
-TARGET_LINK_LIBRARIES(${target} ${daemon_pkg_LDFLAGS} -ldl)
+TARGET_LINK_LIBRARIES(${target} ${daemon_pkg_LDFLAGS})
# Installing Daemon
INSTALL(TARGETS ${target} DESTINATION ${CMAKE_INSTALL_BINDIR})
* limitations under the License.
*/
-#include <dlfcn.h>
#include <set>
#include <Types.h>
#include <ContextProvider.h>
{
_SI("Load '%s' from '%s'", subject, soPath);
- __soHandle = dlopen(soPath, RTLD_LAZY | RTLD_GLOBAL);
- IF_FAIL_RETURN_TAG(__soHandle, NULL, _E, "%s", dlerror());
+ __soHandle = g_module_open(soPath, G_MODULE_BIND_LAZY);
+ IF_FAIL_RETURN_TAG(__soHandle, NULL, _E, "%s", g_module_error());
- create_t create = reinterpret_cast<create_t>(dlsym(__soHandle, "create"));
- if (!create) {
- _E("%s", dlerror());
- dlclose(__soHandle);
+ gpointer symbol;
+
+ if (!g_module_symbol(__soHandle, "create", &symbol) || symbol == NULL) {
+ _E("%s", g_module_error());
+ g_module_close(__soHandle);
__soHandle = NULL;
return NULL;
}
+ create_t create = reinterpret_cast<create_t>(symbol);
+
ContextProvider *prvd = create(subject);
if (!prvd) {
_W("No provider for '%s'", subject);
- dlclose(__soHandle);
+ g_module_close(__soHandle);
__soHandle = NULL;
return NULL;
}
if (!__soHandle)
return;
- dlclose(__soHandle);
+ g_module_close(__soHandle);
__soHandle = NULL;
}
#ifndef _CONTEXT_PROVIDER_LOADER_H_
#define _CONTEXT_PROVIDER_LOADER_H_
+#include <gmodule.h>
#include <map>
namespace ctx {
ContextProvider* __load(const char *soPath, const char *subject);
void __unload();
- void *__soHandle;
+ GModule *__soHandle;
static ProviderLibMap __providerLibMap;
};