For example, MZ, NE, LX and PE can be overlaid.
Some executable formats were intentionally designed to allow this.
While the Wikipedia article merely describes packing different architectures into the same binary, its actually possible to make one binary that runs on different operating systems so long as the entry points for the operating systems don't collide.
Run mac on windows perfectly code#
īasically, you compile the machine code for each platform you want to run on and then hand-link the code with different entry points. It's called a Fat Binary, and it used to common enough in the 1980's although I haven't seen it done in decades. Yes, you CAN write a multi-platform binary, but it's difficult. How can i combine the Windows executable file with the Linux executable file? Is it possible to generate a single executable file that can run on both platform? However, if i use Cygwin, i will end up having 2 different executable files. I've been googling for a while and i found that I need to use Cygwin to port it to Windows. That C++ program is only available for Linux only. I'm also interested to create a cross-platform Java GUI application using a C++ program as the engine. I just want to know, how can that executable file run on both Windows and Linux?
No matter users use that application in Windows or Linux, the Java GUI will call the same executable file in the bin folder. I'm surprised to find that the backend engine of that GUI application is a small executable file generated from C++ codes. Recently I am studying the source code of an open source, cross-platform Java GUI application. So, if we want to run the same program in both platform, we need to compile the source code under both platform, and create 2 different executable files. From what i know, a program that is compiled in Linux should not be able to run in Windows.