How Windows Portable Executables are portable across machine architecture

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


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.)

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

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.

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.

Need Your Help

Updating a KineticJS Canvas element via Meteor

javascript mongodb canvas meteor kineticjs

I'm trying to make a KineticJS object's position update via Meteor.

How do I handle a multiple select form field in Perl?

perl forms select cgi

What is the best, in Perl, way to get the selected values of a multiple select form field?