언어 설정

Menu
Sites
Language
Use eina_module error
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);

Responses

3 댓글
Alex Dem

Hi,
I have checked your eina_module code, it works for me:
But please note that shared lib should be added this way in your project (it is applicable for Tizen 2.3.0 too):

https://developer.tizen.org/dev-guide/2.2.1/org.tizen.native.appprogramming/html/app_dev_process/adding_libraries_and_library_search_paths.htm

otherwise *.so file will not be presnted in *tpk (package) and  eina_module_load returns false

But you could check that eina_module_load returns true & eina_module_symbol_get does not return  NULL to make sure that all right.
Alexey.

harendra kumar

I have also tried in same way as mentioned by jeonghun cho, But eina_module_load() returns false.

Can some one tell what I am missing.

Alex has shared some way to add shared lib, but not able to open that page.

 

thanks in advance...........

Alex Dem

Hi
I checked recently (with 2.3.0 rev2 win64). It should be ok.
How to call methods from library, see here:
https://developer.tizen.org/forums/native-application-development/ffmpeg-support-tizen
Alexey.