1. call source Eina_Module* e_module = eina_module_new("/opt/usr/apps/org.tizen.libtest/lib/lib_so.so"); Eina_Bool ei_b = eina_module_load(e_module); result_type result2 = RES_OK; const char *value = NULL; char *str_air = "air"; char *str_key = "key"; char* (*get_f)(char*, char*); get_f = eina_module_symbol_get( e_module, "get_v" ); /* It is shot down in the code below */ value = (*get_f)(str_air, str_key); //value = get_f(str_air, str_key); /* shout down */ eina_module_unload (e_module); eina_module_free(e_module); 2. shared library //shared_lib.h EXPORT_API char *get_v(char *str_air, char *str_key); //shared_lib.c char *get_v(char *str_air, char *str_key) { int ret = CKMC_ERROR_NONE; char *str; str = calloc(1, sizeof(char) * 251); strcpy(str, str_air); strcat(str, str_key); char* alias = str; char* key_password = NULL; char* error_c = NULL; ckmc_raw_buffer_s *_data; ret = ckmc_get_data(alias, key_password, &_data); //-31522804 if (CKMC_ERROR_NONE != ret) { switch (ret) { case CKMC_ERROR_INVALID_PARAMETER : snprintf(error_c, DISP_STR_SIZE, "%s", "error : 1"); return error_c; case CKMC_ERROR_DB_LOCKED : snprintf(error_c, DISP_STR_SIZE, "%s", "error : 2"); return error_c; case CKMC_ERROR_DB_ALIAS_EXISTS : snprintf(error_c, DISP_STR_SIZE, "%s", "error : 3"); return error_c; case CKMC_ERROR_INVALID_FORMAT : snprintf(error_c, DISP_STR_SIZE, "%s", "error : 4"); return error_c; case CKMC_ERROR_DB_ERROR : snprintf(error_c, DISP_STR_SIZE, "%s", "error : 5"); return error_c; case CKMC_ERROR_PERMISSION_DENIED : snprintf(error_c, DISP_STR_SIZE, "%s", "error : 5"); return error_c; default : snprintf(error_c, DISP_STR_SIZE, "error code : %d", ret); return error_c; // => -31522804 Returned } char *ret_str; ret_str = calloc(1, sizeof(char) * DISP_STR_SIZE); eina_strlcpy(ret_str, magic_data->data, magic_data->size+1); ckmc_buffer_free(magic_data); return ret_str; }
아래의 호출 부분의 아래 소스코드에서 다운됩니다.
어떤 문제인가요?
value = (*get_f)(str_air, str_key);