Diff. bet. .OBJ file n .EXE file?

510 views
Skip to first unread message

TheSuyog

unread,
Aug 5, 2010, 11:57:09 AM8/5/10
to Knowledge Test
Hey guys! I'm back with another question for you....

1. Whats supposed to be the difference between the .obj file and
the .exe file that are created by the C/C++ compiler (Turbo C++ 3.1)
when we compile a program?

and my other question is:
2. How does the Object code differ from the Java Bytecode? Or they
don't have any relation at all?

Reply awaited!

neha mungee

unread,
Aug 6, 2010, 3:34:12 AM8/6/10
to Knowledge Test
ans 1. Object files are formed by compiler before linking to
libraries,thus contain unresolved symbols and method definitions and
therefore r unexecutable. exe files r made after linking to libraries
is done.

Supriya Jain

unread,
Aug 6, 2010, 3:36:40 AM8/6/10
to knowledge-...@googlegroups.com

Both are binary files but the differences between those are:-
1) we can execute an executable file while we cannot execute an object file.

2) An object file is a file where compiler has not yet linked to the libraries, so you get an object file just before linking to the libraries, so still some of the symbols or function definitions are not yet resolved which are actually present in the libraries, and that's why we cannot execute it.
Once an object file is linked with the library by the compiler, then all the symbols are resolved and we get an executable file which can be executed on the appropriate platform.
So basically the difference is that we get an object file when we don't link with library while executable file is with the linking phase.

Supriya Jain

unread,
Aug 6, 2010, 3:49:41 AM8/6/10
to knowledge-...@googlegroups.com

Object code is an intermediate representation of code generated by a compiler after it processes a source code file(.java file) and Java bytecode is the form of instructions that the Java virtual machine executes.



On Thu, Aug 5, 2010 at 9:27 PM, TheSuyog <himanshu...@gmail.com> wrote:

TheSuyog

unread,
Aug 6, 2010, 9:15:44 AM8/6/10
to Knowledge Test

All your answers to the 1st question are absolutely correct (good
work!). But for the 2nd question, the Object code is ultimate
executable code that is desired and is executed by the processor, in
other terms, executable code, which is machine-dependent. While the
Bytecode (Common Intermediate Language, in case of .Net Framework) is
the intermediate representation of the source program that is
interpreted/compiled(by JIT Compiler) when we execute our program,
hence is machine-independent.

I hope I'm clear. :)

Supriya Jain

unread,
Aug 6, 2010, 10:04:11 AM8/6/10
to knowledge-...@googlegroups.com
hmmm rit...i frgt to include words "machine dependent" n "machine independent"....
Reply all
Reply to author
Forward
0 new messages