tags:

views:

31

answers:

1

hi... during compilation of dynlinktest.c it gives following error:

unipro@ubuguest:~$ cc dynamiclinktest.c -o dynamiclinktest /tmp/ccli8dp2.o: In function main': dynamiclinktest.c:(.text+0x53): undefined reference todlopen' dynamiclinktest.c:(.text+0x83): undefined reference to dlsym' dynamiclinktest.c:(.text+0x109): undefined reference todlclose' collect2: ld returned 1 exit status

after using cc dynlinktest.c -o dynlinktest -ldl it runs. i didn't get why it is neccessary using -ldl ?

edit1: leaving space before error.

+3  A: 

-ldl includes the reference to the library that has the symbols for loading dynamic libraries (such as dlopen).

Gian