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 andgetpid functions


+/* 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)
  {

I think you're getting it wrong. This is only a wrapper function to provide a functionnal getlog(), which is then used as usual in PREFIX(getlog). The entire relevant section of that file looks like:


/* 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)
{
  static char name [UNLEN + 1];
  DWORD namelen = sizeof (name);

  GetUserName (name, &namelen);
  return (name[0] == 0 ?  NULL : name);
}

#undef getlogin
#define getlogin w32_getlogin
#define HAVE_GETLOGIN 1

#endif


/* GETLOG (LOGIN), g77 intrinsic for retrieving the login name for the process. CHARACTER(len=*), INTENT(OUT) :: LOGIN */

#ifdef HAVE_GETLOGIN
void PREFIX(getlog) (char *, gfc_charlen_type);
export_proto_np(PREFIX(getlog));

void
PREFIX(getlog) (char * login, gfc_charlen_type login_len)
{
  // here, we use getlog(), whether it is provided by the system or by
  // the above mingw-specific wrapper
}
#endif

I'm not sure what I can say to convince you...
FX


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