Dynamic libraries in C: creating something on what others will rely.

  1. Creating new worlds with GNU Compiler Collection.
  2. The power of a book, or how to use static libraries in C.
  3. Dynamic libraries in C: creating something on what others will rely. (this article)

0. Static vs Dynamic

1. How to create the dynamic library

gcc -shared -Wl,-soname,libtools.so -o libtools.so *.o

2. How to use a dynamic library

export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH
gcc our_sources.c -L. -ltools -o resulted_program
nm libtools.so

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Sergii Garkusha

Sergii Garkusha

142 Followers

Hacker. 500 Startups Alumni. Envato Elite. School of AI Dean. Runner. Ukrainian. I write about software, AI & life. SF 🌁 https://cu7io.us