int main(void){
    void* handle;
    char *error;

    handle = rll_open(LIB);
    if (!handle) {
        printf("could not open shared object\n");
        if ((error = rll_error()) != NULL)  {
            printf("an error accured:\n\t%s\n", error);
        }
        exit(1);
    }

    int (*addXtoY) (int, int) = rll_get(handle, "addXtoY");
    if ((error = rll_error()) != NULL)  {
        printf("an error accured:\n\t%s\n", error);
        exit(1);
    }
    int (*subtractYfromX) (int, int) = rll_get(handle, "subtractYfromX");
    if ((error = rll_error()) != NULL)  {
        printf("an error accured:\n\t%s\n", error);
        exit(1);
    }

    printf("%i\n",addXtoY(10, 5));
    printf("%i\n",subtractYfromX(10, 5));

    rll_close(handle);
	return 0;
}
Пример #2
0
/* get os information */
int osi_get_os_details(void *open, void *read, void *lseek, char ***osinfo)
{
    int status =0;
    int i=0;
    char **info = NULL;
    

    if(!osinfo) 
    {
        fprintf(stderr, "Invalid parameters\n");
        return 0;
    }

    rghandle = (void *)rll_open_file_clbks(open, read, lseek);

    if(!rghandle)
    {
        fprintf(stderr, "Failed to open registry file \n");
        return 0;
    }

    //get the os info
    osi_get_os_info(&info);
    *osinfo = info;

    /*
    for(i=0; i<OS_INFO_END; i++)
    {
        switch(win_keys[i].type)
        {
        case REG_STRING:
            info = rll_get_value_strings(rghandle, win_keys[i].key, win_keys[i].recursive);
            break;
        case REG_DWORD:
            info = rll_get_value_dwords(rghandle, win_keys[i].key, win_keys[i].recursive);
            break;
        case REG_ALL:
            info = rll_get_subtree_value_strings(rghandle, win_keys[i].key);
            break;
        default:
            fprintf(stderr, "Invalid key type %d \n", win_keys[i].type);
        }
    
        if(info)
        {
            print_info(i, info);
        }
        else
        {
            fprintf(stderr, "No info found for %s \n", win_keys[i].key);
        }
    }
    */

    rll_close(rghandle);
    return 0;
}