Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use dynamic Link Library in Linux system

2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Today, I will talk to you about how to use dynamic link libraries in the Linux system. Many people may not know much about it. In order to make you understand better, the editor has summarized the following contents for you. I hope you can get something according to this article.

Compared with ordinary programs, dynamic link library has no main function, so it is the implementation of a series of functions. So dynamic link library files are produced through shared and fPIC compilation parameters. When the program calls the library function, it only needs to connect to the library. For example, the following implementation of a simple integer four transport dynamic link library, the definition of caculate.h and caculate.c two files, production libcac.so dynamic link library.

Commands useful for binaries

View file types

File

See which libraries the binaries are linked to

Ldd

Look at the symbol,T contained in the binary file for loading, and U for undefined symbol

Nm

Read the information in the binary file

Readelf-a smu.o

Convert binaries to assembly

Objdump-d sum.o

Generation of dynamic Link Library

Sum.c

# include # include int sum (int x) {int I, result=0; for (iFO; I 100) exit (- 1); return result;}; void display (char* msg) {printf ("% s\ n", msg);} int add (float a dint float b) {return aplanb;} int sum_array (int array [], int num) {int ionomy 0, sum = 0; for (iLife0; I)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 300

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report