Currently, when building for and using the Cygwin runtime,
non-standard CRT functions are not available in the headers, and there
is no import library for the CRT to link them.

For example, the Cygwin "string.h" does not define `stricmp()`, a
non-standard MSVCRT function, which I will use as an example of this
problem.

It is possible to solve this problem by declaring the function and
adding the CRT import library after the Cygwin runtime import library
in the link order.

I have an example for how to do this here:

https://github.com/rkitover/cygwin-binary-with-ucrt-example

, see the Makefile for the link command.

The Cygwin/MSYS2 w32ap-headers packages do not have the CRT headers,
and their w32api-runtime packages do not have the CRT import libs, but
I will deal with that problem separately later once it's ready to be
dealt with.

What I wanted to discuss here, is my proposal for fixing this problem
in the headers.

Currently we have the "crt" directory for the CRT headers, I would
like to propose that we split this into "crt" and "crt-nonstd", so,
for example, "crt/string.h" would contain all of the POSIX functions
defined for "string.h" and "crt-nonstd/string.h" would contain
`stricmp()` and any other non-standard functions.

The "crt/string.h" would include "crt-nonstd/string.h", including it
explicitly would not be required for MinGW compilations.

When another Win32 API header uses these functions, it would have code
similar to:

```c
#include <crt-nonstd/string.h>
```
, for the sake of Cygwin compilations and possibly other things that
may have this problem.

I will work on this with your help, or any other solution you decide
on, if you decide that this should be solved.


_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to