1, EXE itself is a container, it can be on the arm platform contains arm native code execution, can also include x86 native code execution on the x86 platform, essentially no difference (so trouble those who say EXE can not run on the arm platform for students to delete the answer? )。
2.The appx file does not contain bytecode, but is a mixture of native code for various architectures, Microsoft does want to unify the world with. NET bytecode, but now most of the appx files are native code.
-------------------------Body-------------------------
In principle, an operating system can run "Same" (note quotes) code on different platforms at the same time, but there are two forms:
1, learn Java, do bytecode, and then explain the implementation, just need to do a good interpreter on different platforms;
2, if you want to support both the x86 platform and the arm platform, then the release of two versions of the binary files, and then packaged together is good;
How do you think Microsoft would do that?
。
。
。
。
。
。
。
。
。
。
。
。
。
。
。
。
。
。
Of course it's the second kind.! Microsoft has been a bundle of compatibility since ancient times, you think Microsoft may be completely from writing a platform to the tens of thousands of WINDOWSAPI in Java or some other language to re-encapsulate it? Don't dream about it.
You think that Windows can run on arm. It must be Microsoft's black tech. Just set the target file into arm format andre-compile Windows againJust, the arch-related parts to be re-implemented is OK. In other words, Windows running on ARM, with arm hardware instructions, there is no black technology. N years ago someone tried to change Windows to Java, the efficiency will be reduced to the original One-third (not responsible for the authenticity of this statement).
Then someone will raise their hands and ask, "Alas?" No, Windows is not out of a new format called appx? Isn't this the format of cross-platform? OK, let's uncover the mystery of the appx file format:
The appx is explained on Wikipedia (APPX) as follows:
APPX is the file format used to distribute and install application software and middleware for Windows Store apps AP Plications in Windows 8 and beyond. [1] It also replaces the XAP file format on the Windows Phone, from version 8.1, in an attempt to unify the distribution of APS Plications for Windows Phone and Windows 8. [2]
The sidebar is deliberately labeled:
Type of Format: Package
management System, file archive
Do you understand? The appx essence is the container for a packaged executable that you can put anything in this container. Still don't believe it? Then I have to prove that I have just arrived at a mobile forum to download a cracked WP application, just download it is this:
Look, I'm using 7-zip to unzip it:
Sure enough, there are appx files:
Continue to unzip the appx:
Let's see what this is:
After unpacking the appx there is a bunch of resource files and an EXE, and several dll!
Open this EXE to see the truth:
There are even DOS stub heads.
Note that there is a PE head in the offset 0x100, the 0x104 position is 0x01c4, what is this thing? There is an explanation in Microsoft's SDK:
The two bytes of this position represent the machine type, and 0X01C4 also finds an explanation:
0x01c4 - ARMv7 (or higher) Thumb mode only
Here are the more machine type codes: Windows-check if EXE is 64-bit
In other words, exe executable file (exactly should be called PE) is able to encapsulate any platform machine code, whether it is arm or x86, according to the SDK, in fact, can also support MIPS, SH, PPC, Alpha and so on. An EXE file compiled into an arm platform, running on an arm phone,no problem at all.。
EXE is platform-independent, who said EXE can only run on x86?
The so-called appx can be run on arm, is to use the compiler to recompile the game, the creation of an arm platform executable file, the executable file and the appx package to change the name is OK, but this executable file can not be run on x86 cross-platform:
。
。
。
。
。
What about cross-platform?
。
。
。
。
In fact, the real cross-platform is this, if an appx want to cross-platform, developers have to compile both the ARM platform and x86 platform two target files, generate two exe, one on ARM run, one on the x86 run, and thenPackage two exe to the same appx at the same timeIn
So it's a cross-platform.
It's actually about releasing two different versions.
APPX cross-platform format:
This allows the appx to be used on two platforms at the same time.
Isn't it witty?
So, we can wash and sleep, there is no real cross-platform.
---------------------Supplement---------------------
Some people say that Android APK also has native code, can not prove that there is no other native code, the problem is:
1, the appx no other things, only one EXE file, then the code can only be in the EXE file.
2, EXE header in the entire EXE is ARMV7 native code, then ask if there is a byte code, then the byte stacking to where?
Here's another one, the effect of the appx decompression:
where does the bytecode hide?
Of course, I do not rule out arm platform EXE has some section is byte code, but the whole is a ARMv7 PE file.
Moreover, C # decompile it out like this:
The EXE in the appx is decompile:
don't tell me it's a thing, don't tell me. The latter is also bytecode.
------------------for students who do not understand cross-platform development------------------
Cross-platform development is not about two sets of code,The code actually has only one set, the selection of the target file when compiling is more than one platform.
In other words, when compiling a time, the development of the time is not how to differentiate the platform:
It's all on the selection.
---------------------Add---------------------
Does anyone think this will get bigger if the installation package becomes larger? actually not much.
Software accounted for the local are all kinds of resources, the real code part is actually very small, according to my decompression content can be seen, EXE is not the largest, the largest are all kinds of resources, appx to do code and resource separation, so that is enough. A game on the GB, most of them are stickers, sound, video these things.
Win10 so-called unification, more like a unified API, to know that before, not all APIs are exactly the same, if the API is different, cross-platform want to use a set of code is basically impossible.
References
http://www.zhihu.com/question/29642139
How is Windows 10 unified across the platform?