Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm not asking about how to make a Windows exe work in Linux.

I'm asking WHY it does not work.

What is different about the way Windows runs an executable and Linux runs an executable? Why did they have to be different? Besides, why don't linux executables have a file extension?

share|improve this question
    
add comment

3 Answers 3

up vote 30 down vote accepted

Linux and Windows executables use different formats. Linux uses the ELF format on most architectures, while Windows uses the PE format. ELF is better suited to the way Linux manages shared libraries, and PE is better suited to the way Windows manages shared libraries, but there's no fundamental reason why Linux couldn't execute PE executables or Windows ELF executables. In fact Linux can execute PE executables, through Wine.

The difficulty is that Windows and Linux have completely different APIs: they have different kernel interfaces and sets of libraries. So to actually run a Windows application, Linux would need to emulate all the API calls that the application makes. That's a lot of work. Wine does it to some extent, but it's very hard, especially since the maker of Windows doesn't cooperate. You can compare it with, say, learning English when your native language is Chinese: the executable format is the alphabet (not that hard to master), the API is the vocabulary (takes years to get to a level where you can start reading literature).

share|improve this answer
7  
"Vocabulary" is an excellent analogy. –  Dennis Williamson Nov 11 '10 at 18:32
    
I think you meant completely different. –  Mircea Chirea Nov 11 '10 at 21:28
add comment

Windows binaries have a different ABI and use a different API than Linux binaries.

Linux binaries don't need an extension because *nix uses permission bits to identify an executable instead of the extension.

share|improve this answer
1  
Agree with the answer...additional piece of data that may be relevant: ELF(en.wikipedia.org/wiki/Executable_and_Linkable_Format) vs PE(en.wikipedia.org/wiki/PE_executable) –  hbdgaf Nov 11 '10 at 13:33
    
Ah yes, it needs a different loader as well. en.wikipedia.org/wiki/Loader_%28computing%29 –  Ignacio Vazquez-Abrams Nov 11 '10 at 13:35
add comment

This is how I heard the windows side explained in laymans terms from programmers.

In Windows there are hooks in programs and the OS that Exe's make calls to that just wont be there in Linux. Because of the differences in both the environments. Initially Linux looks for permissions, Windows looks for a linkable format first by examining the extension, looking at properties then looking inside the Exe file etc.

There are applications like Netbackup that started out in linux and have been modified to run in windows environment with out using wine IMHO, frequently those are some of the most stable best behaving Windows Apps.

When Windows Apps. become unruly usually it is because some of those hooks held by the application weren't completely released and windows thinks they were (Memory Leaks). When Windows hands that unreleased memory space out to another application Crash and burn.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.