Hi Kees, > Basically, the mingw headers are patched for inclusion of the corresponding > *x.h files; see also the 'installation and usage' section on > http://gnuwin32.sourceforge.net/packages/libgw32c.htm. ...
I *really* don't like to do this. IMHO, the headers supplied with the compiler should be patched *only* to correct defects or omissions, and then only with the sanction of the maintainers of the compiler package itself. If these headers are arbitrarily modified, to accommodate some specific local build system configuration, then maintenance becomes much more difficult, when officially sanctioned patches are applied, or when a compiler upgrade is installed. > ... Then linking with > libgw32c.a is usually suffcient to create succesfully an executable. There > was some discussion about this on the gnuwin32-users list. The whole setup > seemed simple to me, but most users find it difficult to reproduce. It is on > my to-do list to create a more elaborate description on how to compile. > As for 'mkdir', this works well for statically linking to libgw32c.a. If > libgw32c.a is converted into a DLL, then indeed several such problems appear > at the linking stage. It is actually unnecessary to include `mkdir' in libgw32c.a, and IMO, it is probably undesirable. MinGW -- possibly even msvcrt.dll itself -- already provides an implementation of `mkdir', which, when called, is redirected to msvcrt/dll's `_mkdir' function; the prototypes for both of these are defined in MinGW's `io.h' as: _CRTIMP int __cdecl _mkdir (const char*); _CRTIMP int __cdecl mkdir (const char*); whereas, most GNU packages will expect conformance with POSIX semantics, having a prototype something like: extern int mkdir (const char *path, mode_t mode); Thus, when we compile a GNU package with MinGW, we need to override the `io.h' prototype with a POSIX compliant declaration, such as the example which may be found in groff's `nonposix.h': #if defined(__MSDOS__) || defined(__EMX__) \ || (defined(_WIN32) && !defined(_UWIN) && !defined(__CYGWIN__)) . . # define mkdir(p,m) _mkdir(p) . . #endif In this way, any reference to mkdir( path, mode ) in the source is mapped by the compiler to _mkdir( path ), and there is absolutely no need to provide any wrapper function, in any statically linked library. There are many other functions which can be handled in a similar manner; suitable prototype overrides for several of them can also be found in groff's `nonposix.h'. IMO, this approach, as adopted by groff, is the most appropriate method for handling the idiosyncrasies of differing operating platforms -- place *all* the non-standard stuff in a single header file, and #include it as the *last* included header, in *every* source file. Of course, this means that it becomes necessary to patch the source packages, to accommodate this strategy. In an ideal GNU world, there would be *one* standard `nonposix.h' file, shared by *all* GNU projects, and all GNU sources would already #include it -- unfortunately, even the GNU world isn't this ideal. Best regards, Keith. ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ GnuWin32-Users mailing list GnuWin32-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gnuwin32-users