The difference between Cygwin and MinGW

Source: Internet
Author: User

Prior to doing some JNI development, installed MinGW, recently a project needs to use Cygwin, so there is a question, what is the difference between these two things? Read some information on the Internet, copy and paste it here, in case of later check.

The C code compiled under UNIX is not possible under Win32, and of course UNIX and Win32 APIs are compliant with standard C, that is, most function calls are identical under UNIX and Win32. However, UNIX has its own unique API (such as fork, Spawn,signals,select,sockets, etc.), if these APIs are used in the code, the corresponding libraries are not found under Win32.

However, the functionality of these APIs can also be implemented in Win32, and you may have discovered a way for Windows to compile UNIX-style code:
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.

MinGW compared to CYGWIN/GCC, more close to Win32. Because it almost supports all the WIN32API. It is connected to a program that does not require any third-party libraries to run.
CYGWIN/GCC, this is actually two things. Cygwin is a software that lets windows have a unix-like environment. And GCC is the compiler installed on the Cygwin.

The biggest difference between CYGWIN/GCC and MinGW is that using CYGWIN/GCC can be used to downgrade the Unix-like API in Windows (such as fork,spawn,signals,select,sockets, etc.). This means that Cygwin is running under windows, but she uses the functions and ideas of the unix-like system. Because of this difference, the result is that the program compiled with CYGWIN/GCC can run seamlessly in the *nix environment. However, if you call the UNIX-specific API functions that do not work in a Windows environment, you must rely on cygwin1.dll if you want to work properly under Windows, with some impact on speed.
And the program compiled with MinGW, if the source code calls the UNIX environment API, then MINGW will translate these API calls to UNIX into Win32 equivalent form. At the same time, this program is not running under Windows.
Frankly speaking, if you want to develop Linux running Program in Windows environment, then CYGWIN/GCC is your choice.
And if you want to develop a Windows runtime program and pursue speed, MinGW is a better choice than the two.

Original link: http://blog.csdn.net/embededvc/article/details/6829010

The difference between Cygwin and MinGW

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.