This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [libgfortran,patch] MinGW wrapper for getlogin, gethostname and getpid functions


On Sun, Sep 25, 2005 at 12:40:35PM +0200, FX Coudert wrote:
> +/* Windows32 version */
> +#if defined __MINGW32__ && !defined  HAVE_GETLOGIN
> +#define WIN32_MEAN_AND_LEAN
> +#include <windows.h>
> +#include <lmcons.h>  /* for UNLEN */ 
> +
> +static char *
> +w32_getlogin (void)

This is wrong.  For all other OS's, we have

  void PREFIX(getlog) (char *, gfc_charlen_type);
  export_proto_np(PREFIX(getlog));

  void
  PREFIX(getlog) (char * login, gfc_charlen_type login_len)
  {

at a minimum you need to have 

  static char * PREFIX(getlog) (void);
  export_proto_np(PREFIX(getlog));

  static char *
  PREFIX(getlog) (void);

If MinGW does not support export_proto_np, then you at least need
the PREFIX().

> +#ifdef __MINGW32__
> +#define HAVE_GETHOSTNAME
> +#include <windows.h>
> +int gethostname_mingw (char *, size_t);
> +
> +int
> +gethostname_mingw (char *name, size_t len)
> +{

See above.

-- 
Steve


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]