We’ve been conscious of initiatives like Cosmopolitan that mean you can crank out a single executable that can run on totally different working programs. [Kamila] seen that the thought was sound, however that the executables had been giant and there have been some limitations. So she produced a 13K file that can run below Home windows, Linux, and even in a Net browser. This system itself is an easy snake sport.
There appears to be little sharing between the three variations. As a substitute, every model is compressed and stitched collectively so that every platform sees what it needs to see. To accommodate Home windows, the file has to begin with a PE header. Nonetheless, there’s sufficient flexibility within the header that a part of the stub varieties a sound shell script that skips over the Home windows code when working below Linux.
So, primarily, Home windows skips the “rubbish” within the header, which is the half that makes Linux skip the “rubbish” within the entrance of the file.
That leaves the browser. Browsers will throw away every little thing earlier than an tag, in order that’s the straightforward half.
Must you do that? Most likely not. However in case you wanted to make this occur, this can be a clear template for how one can do it. If you wish to return to [Kamila’s] inspiration, we’ve coated Cosmopolitan and its APE format earlier than.
Elevate your perspective with NextTech Information, the place innovation meets perception.
Uncover the most recent breakthroughs, get unique updates, and join with a world community of future-focused thinkers.
Unlock tomorrow’s traits at the moment: learn extra, subscribe to our publication, and turn out to be a part of the NextTech group at NextTech-news.com

