Phương Linh
New member
How do I create a shared library in Linux?
Answer
Example with code:
Answer
Example with code:
- Compile the library functions: gcc -Wall -fPIC -c ctest1.c ctest2.c.
- Generate the shared library: gcc -shared -Wl,-soname,libctest.so.1 -o libctest.so.1.0 ctest1.o ctest2.o. …
- Move to lib/ directory: …
- Configure the library path (see below and choose one of three mechanisms). …
- Run the program: ./prog Valx=5.