Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- gcc -c -Wall -Werror -fPIC shared.cc -shared -o libshared.so
- gcc -L. -Wall share.cc -o share -lshared
- share.cc:
- #include<stdio.h>
- extern unsigned int add(unsigned int a, unsigned int b);
- int main(void)
- {
- unsigned int a = 1;
- unsigned int b = 2;
- unsigned int result = 0;
- result = add(a,b);
- printf("\n The result is [%u]\n",result);
- return 0;
- }
- shared.cc:
- #include<stdio.h>
- extern unsigned int add(unsigned int a, unsigned int b);
- unsigned int add(unsigned int a, unsigned int b)
- {
- printf("\n Inside add()\n");
- return (a+b);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement