MinGW and Cygwin
==========================
First, both MinGW and Cygwin can be used for cross-platform development.
MinGW is the minimalistic GNU for Windows abbreviation, which is the lite gcc for win edition.
MinGW collects a series of free Windows-used header files and library files, and integrates the GNU (http://www.gnu.org/ ) toolset, especially GNU program development tools such as classic GCC, g++, make, etc.
Microsoft has a UNIX-only subsystem development environment, but just a POSIX subset, many of the Linux functions are not available, of course fork is fine.
Cygwin is a comprehensive simulation of the Linux interface, provided to run on the program used in it, and provides a large number of ready-made software, more like a platform.
The relative MinGW also has a sub-project called Msys (Minimal System), which mainly provides a simulation of the Linux shell and some basic Linux tools. Because compiling a large program, relying on a GCC is not enough, also need to have autoconf and other tools to configure the project, so generally under Windows compiled Linux under the large project is done by Msys, of course, Msys is only a secondary environment, The basic work is still mingw to do.
The difference between a program compiled with MinGW and Cygwin
===================================
First of all, MinGW and Cygwin cannot let Linux programs run directly on Windows, and must be recompiled by source code.
Modern operating systems include the basic design concepts of Windows and Linux like the process thread address space virtual memory These are all the same, the reason why the programs on the two are not compatible, mainly because of their specific implementation of the differences in these features,
First is the format of the executable file, window uses the format of the PE, and requires the. EXE is the suffix name. Linux uses the elf.
Second, the operating system's APIs are different, such as Windows creates a process with CreateProcess (), while Linux uses fork ().
So the transplant program is bound to change in these places,
MinGW's Solution:
To replace the system call API directly in the code in Linux with the corresponding API under Windows. Therefore, the generated execution file has not seen the Linux system call API .
Cygwin solution:
Cygwin enables the conversion of two platform APIs by cygwin1.dll this dynamic library. The Cygwin generated program still has a Linux system call API such as fork (), except that the conversion to Windows functionality is implemented in cygwin1.dll.
The program compiled with MinGW is a bit higher, and it doesn't have to take that close to the two trillion cygwin1.dll file.
Sum up
1. Modify the compiler so that the compiler under window translates calls such as fork into equivalent form-this is MinGW's approach.
2. Modify the Library so that window provides a Unix-like library that interfaces to programs like UNIX, and these libraries, of course, are implemented by the Win32 API-this is Cygwin's approach.
This article is from the "Qingfengdian" blog, make sure to keep this source http://cui918.blog.51cto.com/5884562/1877382
MinGW and Cygwin differences