Sample Header Ad - 728x90

How are conflicts avoided in Linux Headers?

0 votes
1 answer
502 views
I'm trying to understand how Linux works and how to build modules. So far I saw that Linux headers are stored in /usr/include and that the compiled implementation of these interfaces are located in /usr/lib/x86_64-linux-gnu. I have a few questions: 1. How does Linux or any C program know where to look for the headers and the .so files? Is there a file where this is defined? Is it possible to modify these references in case I wanted to add another default sources or headers folder (just to horse around)? 2. How are conflicts avoided? For example, in the libprocps-dev there is a header file /usr/include/proc/numa.hwith the definition void numa_uninit (void);. The implementation of this file is in /usr/lib/x86_64-linux-gnu/libprocps.so. What if someone also compiled another .so file with the same function definition but with another implementation (or code) and added it to /usr/lib/x86_64-linux-gnu? How would the Linker know which is the proper .so file that has to be linked to that header definition? Thanks.
Asked by AFP_555 (311 rep)
Nov 25, 2020, 04:51 PM
Last activity: Nov 25, 2020, 05:41 PM