Meaning of library dl in gcc

Dzung Nguyen picture Dzung Nguyen · Oct 2, 2013 · Viewed 23.8k times · Source

I'm checking a makefile, and see that the libraries used are:

LIBS = -lcppunit -ldl

lcppunit is the unit testing library. What is ldl then?

Answer

Chris Stratton picture Chris Stratton · Oct 2, 2013

This is the interface to the dynamic loader, which provides a client program with ability to do things such as explicitly load other libraries, lookup symbols within, etc.

Most programs do not need to do such things explicitly, since the linker does what is needed to enable ordinary usage of shared libraries while loading the program and libraries themselves. However programs that are clever or try to explore and manipulate the dynamic linking system and its data need explicit access. Some of the capabilities are distantly similar to reflection in Java, though with major limitations (such as applying only to dynamic symbols)