views:

173

answers:

4

Is Windows Portable Executables are really portable across machine architectures? If so how it works? If not then what does "Portable Executable" mean or which part of executable is portable?

Thanks, Siva Chandran

+2  A: 

The executables aren't themselves portable. PE format is "portable" in the sense that executables for different architectures use the same PE format, but the executable code within a PE file is specific to a single processor architecture.

In practice this means that a lot of the same compiler and linker code can be reused for different architectures, and that tools for examining executables can (to some extent) work for "foreign" executables.

(I'm talking about native executables here - .NET assemblies also use PE format and can be truly portable.)

RichieHindle
A: 

From Wikipedia: "The term "portable" refers to the format's versatility in numerous environments of operating system software architecture."

http://en.wikipedia.org/wiki/Portable%5FExecutable

Robert MacGregor
A: 

Well, it is portable in means of that the format can be used for executables on various platforms (SkyOS used it before they switched to ELF). It is not portable in means of platform independent code or that if you produce a PE file on one OS that it runs on another.

A: 

PE-files are just containers for binary application data. They allow to target different CPU architectures (or even non-CPU software architectures like .Net). That is why they are called "portable".

Each binary application image they contain, however is suited for exactly one architecture.

Foxfire