View Feed
group-icon
Coffee Room
Discuss anything here - everything that you wish to discuss with fellow engineers.
12940 Members
Join this group to post and comment.
simanchal010
simanchal010 • Feb 14, 2010

how a source code of a programe is being converted into object code

please tell me the way of conversion detail, from source code to object code of a programme.:wink:

please give me detailed information about this topic.:wink:
gaurav.bhorkar
gaurav.bhorkar • Feb 14, 2010
  • You write the source code.
  • The compiler translates the your code into binary code (OBJ).
  • The linker extracts the OBJ code from the standard library (for the std. lib. functions like printf you use.
  • The linker links your code with the extracted code and forms the EXE.
The compiler just translates your source code according to the language rules.
gaurav.bhorkar
  • You write the source code.
  • The compiler translates the your code into binary code (OBJ).
  • The linker extracts the OBJ code from the standard library (for the std. lib. functions like printf you use.
  • The linker links your code with the extracted code and forms the EXE.
The compiler just translates your source code according to the language rules.
hi gaurav,
i think firstly high lable lang source code is converted into assembly source code by the help of compiler and then converted into .obj by using assembler .
.
please correct me if i m wrong.
.
😒
gaurav.bhorkar
gaurav.bhorkar • Feb 15, 2010
mohit007kumar00
hi gaurav,
i think firstly high lable lang source code is converted into assembly source code by the help of compiler and then converted into .obj by using assembler .
.
please correct me if i m wrong.
.
😒
Ya assembler is used there. But that process comes under compilation.
sushant005
sushant005 • Feb 15, 2010
gaurav.bhorkar
  • You write the source code.
  • The compiler translates the your code into binary code (OBJ).
  • The linker extracts the OBJ code from the standard library (for the std. lib. functions like printf you use.
  • The linker links your code with the extracted code and forms the EXE.
The compiler just translates your source code according to the language rules.
Hi gaurav,
I agree with u.
But tell me that in all this whole process is there any involvement of preprocessor.😁
gaurav.bhorkar
gaurav.bhorkar • Feb 15, 2010
sushant005
Hi gaurav,
I agree with u.
But tell me that in all this whole process is there any involvement of preprocessor.😁
Look, pre-processor is the first "place" where your source code goes to. The preprocessor converts it to the expanded source code and then sends it to the compiler......and so on.

Pre-processing, compiling, assembling are all together called as compilation (maybe because they are very related). Even linking is sometimes considered a part of compilation process.
simanchal010
simanchal010 • Feb 16, 2010
gaurav.bhorkar
  • You write the source code.
  • The compiler translates the your code into binary code (OBJ).
  • The linker extracts the OBJ code from the standard library (for the std. lib. functions like printf you use.
  • The linker links your code with the extracted code and forms the EXE.
The compiler just translates your source code according to the language rules.
gaurav please elaborate the third point.....

okay gaurav u have complited within the 4 points.......but where is the work of loader?? actually i dont know that much all these topics are new for me.😔😕
gaurav.bhorkar
gaurav.bhorkar • Feb 16, 2010
simanchal010
gaurav please elaborate the third point.....
😕
Lets take the C language,
THe standard library available with the compiler is always in binary format and not in source code format.
The declarations of the standard library functions are written in the header files. Declarations are just there for the compiler to cross-check whether you've passed the correct no. of arguments to a function.

So, whenever you use printf() in a C program, the linker searches for the printf object code in the std library, extracts it and puts it into your program's object code to make an exe (executable) file.

okay gaurav u have complited within the 4 points.......but where is the work of loader?? actually i dont know that much all these topics are new for me.:sad:😕
I haven't heard of a loader in a compiler.
Are you talking of the program loader (which is a component of OS)?
sherya mathur
sherya mathur • Feb 17, 2010
In computer science, source code (commonly just source or code) is any collection of statements or declarations written in some human-readable computer programming language. Source code is the mechanism most often used by programmers to specify the actions to be performed by a computer.
The source code which constitutes a program is usually held in one or more text files, sometimes stored in databases as stored procedures and may also appear as code snippets printed in books or other media. A large collection of source code files may be organized into a directory tree, in which case it may also be known as a source tree.
A computer program's source code is the collection of files needed to convert from human-readable form to some kind of computer-executable form. The source code may be converted into an executable file by a compiler, or executed on the fly from the human readable form with the aid of an interpreter.
The code base of a programming project is the larger collection of all the source code of all the computer programs which make up the project.
gaurav.bhorkar
gaurav.bhorkar • Feb 17, 2010
@shreya mathur: We don't need copy-paste from other sources. Please mention the source if you copy.
thechamp
thechamp • Feb 28, 2010
if anyone can elaborate the role of interpreter(particularly and discretely) in compiling of a scource code in C++.
also, if someone has some experience in developing interpreter for C++, can tell me how do i proceed in developing one. and if there are some scope of improvement in presently available interpretrs which i can work upon.
thanks
anzilkasim
anzilkasim • Feb 28, 2010
Once you compile the C source program, the compiler covert this source program which has an extension *.c to *.obj, *.exe and *.bak

Using *.exe file we can run the program, and we can find the object code in *.obj and if any problem happens with the *.c file we can create a new one using the back up file (*.bak).

anzilkasim
Home | Global Software Technologies
thechamp
thechamp • Feb 28, 2010
anzilkasim
Once you compile the C source program, the compiler covert this source program which has an extension *.c to *.obj, *.exe and *.bak

Using *.exe file we can run the program, and we can find the object code in *.obj and if any problem happens with the *.c file we can create a new one using the back up file (*.bak).

anzilkasim
Home | Global Software Technologies
that did not answer any of my query..
anzilkasim
anzilkasim • Feb 28, 2010
Object files are typically produced by a compiler as a result of processing a source code file. Object files contain compact code, and are often called "binaries". A linker is typically used to generate an executable or library by amalgamating parts of object files together. Object files for embedded systems typically contain nothing but machine code but generally, object files also contain data for use by the code at runtime: relocation information, stack unwinding information, comments, program symbols (names of variables and functions) for linking and/or debugging purposes, and other debugging information.

Anzil. K
Project Manager
Home | Global Software Technologies

Share this content on your social channels -