Question:
What does really a Executable is?
Anjaneya
2009-03-04 04:41:21 UTC
So far, I know that compiling C program means source code is converted into machine level language. If so why wont a program compiled in Windows will not run in Linux and vice versa.


Second query, What makes compiled program portable - I mean to say my computer processor will be different form other's, even though executable (compiled in my pc) will work on others (off course on same OS).


Is both question means compiler doesn't translates source code into machine language, instead it converts into language which is understood by specific Operating System?
Three answers:
2009-03-04 05:20:35 UTC
1) The reason an executable doesn't run on all systems is because of the loading process, and the format of the executable file itself. Beyond the application code in the exectuable, there is information on how to load the program, where it starts, etc. This information can, and is often, different between operating systems.



Also, there can be libraries linked in that make system calls that are not supported on some operating systems. For example, calls to open or read files are different on Unix O/S variants vs. windows variants.



2) Programs are portable, within an operating system, across multiple computers because the instruction set for the processor is the same. Also, processors maintain a level of backwards compatability so they have been able to run an instruction set from a predecessor.



3) So, in summary, the file format and libraries used are what make the executable specific to an O/S. The application program itself is generated in machine specific language.
2009-03-04 04:50:53 UTC
1) You need to learn English.

2) Compiling a program written in windows won't run on Linux because they have a different source code, so they read the code differently. It's like trying to open a text document with a media player. Linux won't be able to read the code that windows has written because windows writes it differently.

3) A portable executable is a program that can run without having to 'read' any of the files that are located on windows.
?
2016-10-21 12:15:10 UTC
the place ever you shop them. in case you advise software information then they are frequently in: c:software information and below the call of the utility you're searching for and under that oftentimes below a folder stated as bin. cheers


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...