开发者

What does the `cc` option `-ldl` do in the following command?

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 spac开发者_StackOverflowe before error.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜