简体   繁体   中英

How does a c-compiler recognizes system-calls?

Let's say we want to create a socket using the "socket"-function. How does the compiler know that it has to invoke a system call for that corresponding function? Is there any internal table that records with functions belong to a specific set of library?

The usual method is this:

Your platform's library includes a function called socket that contains the actual code needed to make a system call on your platform. The compiler reads in a header file that tells it that this function exists, the linker connects the compiled code to that function, and the library's implementation of that function makes the actual system call.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM