From a technical POV, what is it that MinGW does that makes gcc possible on windows?

Is it right to comprehend that MinGW is basically taking the gcc source and compiling it into an executable for windows, i.e gcc.exe?

Doesn’t a Windows installation by default currently offer the Win32 API headers that exposes the Win32 API, which would make MinGW offering it once again redundant? Are the headers MinGW offers different to the ones that come with a Windows setup?

When I have an item file compiled by MinGW gcc, can I just connect it to the C runtime library on windows? Due to the fact that the things file produced by MinGW gcc might not be suitable( like uses the very same calling conventions) as the C runtime library on windows, I ‘d believe not.

What do you indicate by “gcc source”? When you say “gcc source” you may mean “the source code of the GCC compiler”. MinGW is a windows variation of GCC, so it takes any C source code and produces executables, and it is GCC so it has the functions of that compiler.

I believe the header submits offered by Microsoft (e.g. windows.h and winusb.h) are not actually suitable with GCC. The MinGW project consists of header files that work with GCC so you can call Windows functions like ReadFile from your program. The last time I inspected, MinGW only had some of the Microsoft header files; it was missing winusb.h.

Why do you want to relate to a Windows runtime library? I understand that cross-compiler interop is possible due to the fact that I as soon as wrote a DLL with the Microsoft C compiler and called it from a MinGW (Qt) program.

GCC is a multi-platform compiler so there is a Linux version, a MacOS variation, a Windows version of this compiler. The “MinGW GCC” is among a minimum of two Windows versions existing. The “MinGW system” is nothing but a collection of the Windows versions of some GNU tools.

I just checked out the MinGW Wiki entry and the “provided by the Win32 API” appears to clarify the difference between “Cygwin” and “MinGW” – not between “MinGW” and the Microsoft C compiler:

For lots of GNU tools there are two various variations available for Windows: “Cygwin” and “MinGW”.

” Cygwin” uses an unique emulation environment to replicate a Unix-like file system. A special library will be linked to the programs where functions like “fopen” will convert file names in the kind “/ home/mydir/myfile. txt” to file names like “c: \ programs \ cygwin \ home \ mydir \ myfile.txt”.

Utilizing the “Cygwin” compiler both the “gcc” command line and the command lines of the programs developed (more exact: linked) by it need Unix-like file names.

The “MinGW” tools nevertheless behave like other Windows programs and use the regular Windows libraries where functions like “fopen” anticipate “normal” Windows-like file names like “c: \ somedir \ somefile”. Programs developed by the “MinGW” GCC compiler act like programs developed by the Microsoft compiler.

Unlike Linux Windows does NOT featured any header files however they come with the Win32 API that has actually to be downloaded (> 1GiB) from Microsoft. MinGW and Cygwin provide some own header files that are nearly suitable with the Microsoft ones so it is not needed to download the Win32 API.

The majority of development tools in Windows utilize the same item and fixed library file format. (The “Watcom” compiler is one of the couple of exceptions.) This means you can mix object and static library files compiled with various compilers. (The format of.lib/. a stub libraries utilized for dynamic connecting against DLLs differs between gcc and Microsoft so you can not blend them!).

About the remark to the other response:.

MinGW typically links to “msvcrt.dll” which comes with Windows. This file includes standard C functions like “printf()”.
Microsoft Visual C++ in some cases connects to “msvcrt.dll”, sometimes to some DLLs like “msvcr100.dll”. “msvcr100.dll” likewise includes basic C functions however a few of them have actually improved performance (e.g. Unicode …). “msvcr100.dll” needs to be post-installed since it does not featured Windows.
Cygwin connect to files like “cygwin1.dll” including the Cygwin version of the basic C functions (that differ in file name handling). Needless to state that this file does not come with Windows however has to be post-installed.

Unlike “libc” in Linux all these DLLs do not straight call the os however they call “kernel32.dll” which consists of lower-level functions (like “WriteFile()”) that will call the os.

Leave a Reply

Your email address will not be published. Required fields are marked *