473,322 Members | 1,398 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

How the compiler in C language differentiates the function and system call

Hi,
This is suresh, newly joined for this community . I have one doubt.


How the gcc compiler ( C Language) on Linux platform knows which is Function call and which is the System call while compilation process ?
Jul 31 '07 #1
4 1671
JosAH
11,448 Expert 8TB
Hi,

and welcome to TSDN; you're question can be much better answered in the C/C++
Forum; please ask again overthere.

kind regards,

Jos
Jul 31 '07 #2
weaknessforcats
9,208 Expert Mod 8TB
How the gcc compiler ( C Language) on Linux platform knows which is Function call and which is the System call while compilation process ?
It doesn't.

During the compile, a function must be defined before it is called. If the function is not in the file being compiled, the function prototype must appear before the function is called.

Any function (yours or a system call) that has no code but only a function prototype will be marked by the compiler as an unresolved external reference in the object file.

The job of the linker when the object files are copied to the executable file is to locate those unresolved extrernal references. In the case of system call, the code for these functions is in libraries available to the linker. When a system function is required, the linker will copy the code for that function from the library to the executable and fix up the addresses so it looks like the system code was part of your program all along.
Jul 31 '07 #3
svlsr2000
181 Expert 100+

In the case of system call, the code for these functions is in libraries available to the linker.
In case if add a new system call, the chances of libraries available to linker having code for this function is nill. Then how are these system calls executed.
Aug 1 '07 #4
weaknessforcats
9,208 Expert Mod 8TB
In case if add a new system call, the chances of libraries available to linker having code for this function is nill. Then how are these system calls executed.
System libraries are not part of C or C++. They are part of the operating system. Or at least they are part of an SDK released with the operating system.

So, suppose you use Windows Vista and there are 5,000 new system calls. If you use these with the Platform SDK from Windows XP you will get missing functions. You would need to install the Platform SDK for Vista to get the new libraries and then you would need to rebuild.
Aug 1 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: Bryan Parkoff | last post by:
You may notice that switch (...) is much faster than function that can gain a big improved performance because it only use JMP instruction however function is required to use CALL, PUSH, and POP...
19
by: Canonical Latin | last post by:
"Leor Zolman" <leor@bdsoft.com> wrote > "Canonical Latin" <javaplus@hotmail.com> wrote: > > > ... > >But I'm still curious as to the rational of having type >...
13
by: Neil Zanella | last post by:
Hello, I wonder whether anyone has ever come across the following g++ compiler error message. I don't recall ever seeing it before. I solved my problem but I am still not sure about what this...
14
by: joshc | last post by:
I'm writing some C to be used in an embedded environment and the code needs to be optimized. I have a question about optimizing compilers in general. I'm using GCC for the workstation and Diab...
10
by: Jon | last post by:
I'm investiging multi-threaded GUI applications; specifically the technique used to ensure that controls are only modified under the correct thread. The standard technique is to use ...
4
by: Siam | last post by:
Hi all, I'm writing a shell language in c++ that supports the generation of random numbers, and by its nature, each command must be executed in a new thread. The call to the random function from...
0
by: erik.erikson | last post by:
I am getting a compiler error that I can't well explain or even understand the origin of (though I boiled it down close...). Below is a bare-bones example. What I am doing is defining the...
41
by: Miroslaw Makowiecki | last post by:
Where can I download Comeau compiler as a trial version? Thanks in advice.
13
by: Albert | last post by:
Hi I'm using the lcc compiler for win32. I tried compiling a program but there's an error stating: "cpp: Can't open input file clrscr()" I don't get it - I've included <tcconio.h>. (strange why...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.