blob: ae51b01732a086118939167ac54e4775204af306 [file] [log] [blame]
#include "gsw_log_interface.h"
void *handle = NULL;
int log_initialized = 0;
mbtk_log gsw_fun_ptr_log;
int init_log_func(void)
{
if (log_initialized)
return 0;
handle = dlopen("/lib/libmbtk_lib.so", RTLD_NOW);
if (!handle)
{
syslog(LOG_ERR, "Failed to load library: %s", dlerror());
return -1;
}
gsw_fun_ptr_log = (mbtk_log)dlsym(handle, "mbtk_log");
if (!gsw_fun_ptr_log)
{
syslog(LOG_ERR, "Cannot load symbol 'mbtk_log': %s", dlerror());
dlclose(handle);
handle = NULL;
return -1;
}
log_initialized = 1;
return 0;
}