-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuser.cpp
More file actions
43 lines (38 loc) · 772 Bytes
/
user.cpp
File metadata and controls
43 lines (38 loc) · 772 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include<iostream>
#include<stdlib.h>
#include"sharedheader.h"
#include<dlfcn.h>
int main()
{
//SinglyLinkedList sll;
void* p=NULL;
SinglyLinkedList* ptr=NULL;
SinglyLinkedList*(*fp1)()=NULL;
void (*fp2)(SinglyLinkedList*)=NULL;
p=dlopen("library.so",RTLD_LAZY);
if(!p)
{
cout<<"unable to load library";
return -1;
}
fp1=(SinglyLinkedList*(*)())dlsym(p,"create");
fp2=(void(*)(SinglyLinkedList*))dlsym(p,"destroy");
ptr=fp1();
cout<<ptr;
ptr->InsertFirst(10);
ptr->InsertLast(20);
ptr->InsertLast(20);
ptr->InsertLast(20);
ptr->InsertAtPosition(30,2);
ptr->DeleteFirst();
ptr->Display();
//ptr->DeleteLast();
//ptr->DisplayN(2);
ptr->DeleteNode(20);
//ptr->DeleteAll();
ptr->Display();
fp2(ptr);
dlclose(p);
cout<<"main";
return 0;
}