namespace Common {
InferenceEngineCommon::InferenceEngineCommon() :
mSelectedBackendEngine(INFERENCE_BACKEND_NONE),
- handle(nullptr),
+ mBackendModule(nullptr),
engine(nullptr)
{
LOGE("ENTER");
InferenceEngineCommon::InferenceEngineCommon(std::string backend) :
mSelectedBackendEngine(INFERENCE_BACKEND_NONE),
- handle(nullptr),
+ mBackendModule(nullptr),
engine(nullptr)
{
LOGE("ENTER");
InferenceEngineCommon::InferenceEngineCommon(inference_backend_type_e backend) :
mSelectedBackendEngine(INFERENCE_BACKEND_NONE),
- handle(nullptr),
+ mBackendModule(nullptr),
engine(nullptr)
{
LOGE("ENTER");
InferenceEngineCommon::InferenceEngineCommon(inference_engine_config *config) :
mSelectedBackendEngine(INFERENCE_BACKEND_NONE),
- handle(nullptr),
+ mBackendModule(nullptr),
engine(nullptr)
{
LOGI("ENTER");
char *error = NULL;
LOGI("lib: %s", mBackendLibName.c_str());
- handle = dlopen(mBackendLibName.c_str(), RTLD_NOW);
- LOGI("HANDLE : [%p]", handle);
+ mBackendModule = dlopen(mBackendLibName.c_str(), RTLD_NOW);
+ LOGI("HANDLE : [%p]", mBackendModule);
- if (!handle) {
+ if (!mBackendModule) {
LOGE("Fail to dlopen %s", mBackendLibName.c_str());
LOGE("Error: %s\n", dlerror());
return INFERENCE_ENGINE_ERROR_NOT_SUPPORTED;
}
- init_t* EngineInit = (init_t *)dlsym(handle, "EngineCommonInit");
+ init_t* EngineInit = (init_t *)dlsym(mBackendModule, "EngineCommonInit");
if ((error = dlerror()) != NULL) {
LOGE("Error: %s\n", error);
- dlclose(handle);
+ dlclose(mBackendModule);
+ mBackendModule = nullptr;
return INFERENCE_ENGINE_ERROR_INTERNAL;
}
engine = EngineInit();
if (engine == NULL) {
LOGE("Fail to EngineInit");
- dlclose(handle);
+ dlclose(mBackendModule);
+ mBackendModule = nullptr;
return INFERENCE_ENGINE_ERROR_INTERNAL;
}
{
LOGW("ENTER");
- if (handle) {
- destroy_t *engineDestroy = (destroy_t*)dlsym(handle, "EngineCommonDestroy");
+ if (mBackendModule) {
+ destroy_t *engineDestroy = (destroy_t*)dlsym(mBackendModule, "EngineCommonDestroy");
engineDestroy(engine);
- dlclose(handle);
+ dlclose(mBackendModule);
engine = nullptr;
- handle = nullptr;
+ mBackendModule = nullptr;
}
LOGW("LEAVE");