- Create 2 files:
main.c that will contain main() func.
libhello.c that will contain hello() func. This func prints Hello, world! to terminal screen.
- Compile
libhello.c as libhello.so;
- call
hello() from main();
- Compile
main.c as main and link it with libhello.so;
- Run
main and observe output.
main.cthat will containmain()func.libhello.cthat will containhello()func. This func printsHello, world!to terminal screen.libhello.caslibhello.so;hello()frommain();main.casmainand link it withlibhello.so;mainand observe output.