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

Example Analysis of Joint compilation dynamic Link Library in centos

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

Share

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

This article shares with you the content of the sample analysis of joint compilation of dynamic link libraries in centos. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

What is a dynamic link library

On Windows is dynamic linklibrary (DLL), suffix? Xxx.dll

On UNIX or Linux, it is Shared Library. The suffix is xxx.so

Compile the file into a dynamic link library in .so format

Gcc-o libme.so wso.c-shared

Compile wso.c into a libme.so library named me

Lib so is a prefix and suffix

Joint compilation

Gcc-L / root/myc/-l me ws.c-o newws

Folder location of-L dynamic link library

-l the name of the dynamic link library (excluding the leading lib and .so is the library name)

Then you will find that the compilation is successful, but the run still fails.

Failed because the operating system could not find it.

In fact, Linux, like windows, has a system library folder similar to system32. All kinds of public class libraries are placed here

There are two folders in CentOS that hold common libraries very similar to windows.

/ lib kernel level

/ usr/lib user system level

/ usr/lib64/ 64-bit system only

It doesn't matter if you leave your library blindly.

Solution method

Copy the SO file we made to the common library (cp command)

Then ldconfig (cache the dynamic library). Add new gadgets and need to update the cache)

Run newws successfully

Thank you for reading! This is the end of this article on "sample analysis of jointly compiled dynamic link libraries in centos". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!

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: 0

*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