| 139 | } |
| 140 | |
| 141 | void lite::set_loader_lib_path(const std::string& loader_path) { |
| 142 | const char* lib_path = loader_path.c_str(); |
| 143 | LITE_LOG("load a device loader of path %s.", lib_path); |
| 144 | auto handle = dlopen(lib_path, RTLD_LAZY); |
| 145 | LITE_ASSERT(handle, "failed to open c opr lib %s: %s", lib_path, dlerror()); |
| 146 | const char* entry = MGB_C_OPR_INIT_FUNC_STR; |
| 147 | auto func = dlsym(handle, entry); |
| 148 | LITE_ASSERT(func, "can not resolve %s: %s", entry, dlerror()); |
| 149 | typedef void (*entry_f_t)(void*); |
| 150 | reinterpret_cast<entry_f_t>(func)( |
| 151 | reinterpret_cast<void*>(&mgb_get_extern_c_opr_api_versioned)); |
| 152 | } |
| 153 | |
| 154 | void lite::set_persistent_cache(const std::string& cache_path, bool always_sync) { |
| 155 | LITE_LOCK_GUARD(cache_control.cache_mutex); |