Solved: What is an executable ?

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

chandhuonline

Thread Starter
Joined
Sep 27, 2008
Messages
5
Hi all...
What is an executable and how it works ?
How i am able to run an executable compiled out of a C program with out installing C on my machine ? and why do i require .net framework to run a program compiled out of Visual Studio.
 
Joined
Jul 29, 2004
Messages
6,650
Hi chandhuonline,

Welcome to TSG ! :)

An executable is simply a serie of commands for the processor. The coding language of processor instructions is called Assembly.
When you run a program, the operating system (Windows, Linux, McOs, ...) will load the executable in the memory with the libraries needed by the program and then, it will launch the execution from there.
Also, for security reasons, an operating system won't allow you to do anything. If you compile a C program with gcc on a Linux system, you won't be able to run its executable on a Windows machine. C like C++ is called a platform dependent language. To do so, you need to have Cygwin installed on the Windows system, Cygwin is simply a Linux environment designed for Windows.
Programs written in C#, Java, VB need a specific runtime (respectively the .Net framework, the JRE, the VB runtime) which interprets the compiled coding and translates it into processor instructions.
 

chandhuonline

Thread Starter
Joined
Sep 27, 2008
Messages
5
Thanks a lot..!

Now more things to get clarified :)

What is runtime and why is it actually needed ?

On my windows machine i can directly execute .js or .vbs files (i.e without installing any external software), so does it mean that windows provides runtime for those scripts by default ?
 
Joined
Jul 28, 2008
Messages
1,899
Runtime is either the time when a executable is running or something related to it running like a runtime library or runtime error. Windows provides runtime libraries for some interpreted languages as standard.
 
Joined
Sep 14, 2005
Messages
919
All languages are compiled into a form of byte code (machine language) that can be executed by the processor. (Java is a little different here but the end result is still the same.) An "executable" is nothing more then the binary form of a program or part of a program that can be executed on a machine.

A run time envirement is not needed in some languages. If the language itself is tied to an operating system it is. If the language is not tied to an operating system (ie, like C or C++), you can usually build with or without a runtime envirement. This is needed for embedded systems and systems without operating systems.

Different programming language envirements handle things differently. Also, please dont confuse scripting languages with programming languages please! Scripting languages are quite different.

On my windows machine i can directly execute .js or .vbs files (i.e without installing any external software), so does it mean that windows provides runtime for those scripts by default ?
Sort of. .vbs (Visual Basic Script) is handled by the Windows Script Host built into Windows. However, it can also be a compiled form. .js are usually javascript files if Im not mistaken...Perhaps someone can correct me here if I am wrong.
 

chandhuonline

Thread Starter
Joined
Sep 27, 2008
Messages
5
yeah you are right .js are javascript/jscript files.

So can you please help me in understanding the difference between scripting languages and languages like C,C++,C#..etc.
 
Joined
Sep 14, 2005
Messages
919
So can you please help me in understanding the difference between scripting languages and languages like C,C++,C#..etc.
scripting languages are a form of data that are executed by programs. Because they are executed by the program and are independent of the program, they can be more higher level, easier to work with, and do not need to be compiled (Although some can be). An example scripting language that is very common (with applications and games) is lua.

Programming languages are a specification (of sorts) that defines a form of data that are complied, interpreted, or assembled (in the case of assembly language) by a program and converted into a binary.This is the binary form of a program file. Normally these are C, C++, Java, C#, assembly, et al..

Markup languages are similar to scripts but they are just data files that represent something. That is, they are not "executed" by anything but parsed. Examples include HTML, XML, etc. Alot of software tend to use xml for configuration information, for an example. All web sites use HTML, either natively are generated by scripts (JavaScript, PHP, ASP...) This is a perfect example of both scripting languages and markup languages.
 

peterh40

Peter
Joined
Apr 15, 2007
Messages
1,458
Program that is compiled is executed, it is already in 'machine code' so can be run straight away without any intermediate stages - no runtime required, no interpreter or anything.

A parsed program has be read in, checked for syntax errors and each line converted to something that can be executed before it can be run. This has to be repeated every time the program is run. The advantage is that the program can be modified immediately and then tried out immediately, the disadvantage is that it takes longer to run the program.
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top