Using GNAT on Windows (GNAT User’s Guide for Native Platforms)

#### 7.4.1 Using GNAT on Windows ¶

One of the strengths of the GNAT technology is that its tool set (`gcc`, `gnatbind`, `gnatlink`, `gnatmake`, the `gdb` debugger, etc.) is used in the same way regardless of the platform.

On Windows, this tool set is complemented by a number of Microsoft-specific tools that have been provided to facilitate interoperability with Windows when this is required. With these tools:

- You can build applications using the `CONSOLE` or `WINDOWS` subsystems.
- You can use any Dynamically Linked Library (DLL) in your Ada code (both relocatable and non-relocatable DLLs are supported).
- You can build Ada DLLs for use in other applications. You can write these applications in a language other than Ada (e.g., C, C++, etc). Again, both relocatable and non-relocatable Ada DLLs are supported.
- You can include Windows resources in your Ada application.
- You can use or create COM/DCOM objects.

Listed immediately below are all known general GNAT-for-Windows restrictions. We list other restrictions about specific features such as Windows Resources and DLLs in separate sections below.

- You cannot use `GetLastError` and `SetLastError` when tasking, protected records, or exceptions are used. In these cases, in order to implement Ada semantics, the GNAT run-time system calls certain Win32 routines that set the last error variable to 0 upon success. You may be able to use `GetLastError` and `SetLastError` when tasking, protected record, and exception features are not used, but it is not guaranteed to work.
- You cannot link against Microsoft C++ libraries except for import libraries. You must do interfacing by means of DLLs.
- You can link against Microsoft C libraries. However, the preferred solution is to use C/C++ compiler that comes with GNAT, since it doesn’t require having two different development environments and makes the inter-language debugging experience smoother.
- When the compilation environment is located on FAT32 drives, you may experience recompilations of source files that have not changed if Daylight Saving Time (DST) state has changed since the last time files were compiled. NTFS drives do not have this problem.
- No components of the GNAT toolset use any entries in the Windows registry. The only entries installation of GNAT may create are file associations and PATH settings, provided you chose to create them at installation time, as well as some minimal bookkeeping information needed to correctly uninstall or integrate different GNAT products.