71 lines
940 B
C
71 lines
940 B
C
#include <stdio.h>
|
|
#include <dlfcn.h>
|
|
#include <locale.h>
|
|
#include <stdlib.h>
|
|
|
|
int main(int argc, char** argv)
|
|
{
|
|
|
|
if(argc < 3){
|
|
printf("Usage");
|
|
return 0;
|
|
}
|
|
|
|
char* niz = argv[1];
|
|
int i = atoi(argv[2]);
|
|
int j = atoi(argv[3]);
|
|
|
|
void* handle = NULL;
|
|
void (*izpis)();
|
|
int (*vsota)(int,int);
|
|
|
|
|
|
handle = dlopen("./libXPO.so",RTLD_LAZY);
|
|
if (handle == NULL)
|
|
{
|
|
perror("Ne morem odpreti libprva.so\n");
|
|
return -1;
|
|
}
|
|
|
|
izpis=(void(*)(void))dlsym(handle,"niz_veliki");
|
|
if (izpis==NULL)
|
|
{
|
|
perror("Ne najdem funkcije izpisi_pozdrav\n");
|
|
return -2;
|
|
}
|
|
izpis(niz);
|
|
printf("%s\n", niz);
|
|
|
|
|
|
vsota=(int(*)(int,int))dlsym(handle,"sestej");
|
|
if (vsota==NULL)
|
|
{
|
|
perror("Ne najdem funkcije sestej\n");
|
|
return -3;
|
|
}
|
|
printf("rezultat: %d\n",vsota(i,j));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dlclose(handle);
|
|
|
|
return 0;
|
|
} |