On Fri, May 31, 2019 at 11:54 AM Gravis <[email protected]> wrote:
>
> I'm a huge fan of POSIX but POSIX functions should not be used in the
> MinGW-w64 CRT code as they are now.  Using them in this way creates
> mandatory dependencies on additional libraries (e.g. MSVCRT).  Since
> all libraries ultimately rely on Kernel32, it only makes sense to
> replace these POSIX functions with those from Kernel32, especially
> since they have almost identical substitutes.  See also:
> https://support.microsoft.com/en-us/help/99456/win32-equivalents-for-c-run-time-functions
>
> Compling the most simplistic program tells you about everything missing.
>
> > emptymain.c
> int main(int argc,char** argv) { return 0; }
>
> > compilation command
> i686-w64-mingw32-gcc -o emptymain.exe emptymain.c -nodefaultlibs
> -lmingw32 -lkernel32
>
> > examples of undefined POSIX symbols
> mingw-w64-crt/crt/crtexe.c:423: `malloc'
> mingw-w64-crt/crt/crtexe.c:428: `strlen'
> mingw-w64-crt/crt/crtexe.c:429: `malloc'
> mingw-w64-crt/crt/crtexe.c:430: `memcpy'
> mingw-w64-crt/crt/crtexe.c:342: `exit'
> mingw-w64-crt/crt/merr.c:72: `fprintf'
> mingw-w64-crt/crt/pseudo-reloc.c:149: `fwrite'
> mingw-w64-crt/crt/pseudo-reloc.c:150: `vfprintf'
> mingw-w64-crt/crt/pseudo-reloc.c:156: `abort'
> mingw-w64-crt/crt/crt_handler.c:many: `signal'
> mingw-w64-crt/crt/tlsthrd.c:48: `calloc'
> mingw-w64-crt/crt/pesect.c:88: `strncmp'
> mingw-w64-crt/crt/tlsthrd.c:87: `free'
> mingw-w64-crt/crt/tlsthrd.c:141: `free'
> mingw-w64-crt/crt/pesect.c:75: `strlen'
> mingw-w64-crt/crt/pesect.c:88: `strncmp'

If you would like to demonstrate this change, you will have better
luck by supplying a patch.  A cursory glance shows that there aren't
universale drop in replacements for everything like you suggest.
fprintf and vfprintf, for instance, are listed as "none" on that page
you linked.


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

Reply via email to