PostgreSQL Source Code  git master
mingwcompat.c File Reference
#include "postgres.h"
Include dependency graph for mingwcompat.c:

Go to the source code of this file.

Functions

static void LoadKernel32 ()
 
 typedef (PHANDLE, HANDLE, WAITORTIMERCALLBACK, PVOID, ULONG, ULONG)
 
BOOL WINAPI RegisterWaitForSingleObject (PHANDLE phNewWaitObject, HANDLE hObject, WAITORTIMERCALLBACK Callback, PVOID Context, ULONG dwMilliseconds, ULONG dwFlags)
 

Variables

const struct in6_addr in6addr_any = {{{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}}
 
static HMODULE kernel32 = NULL
 
static __RegisterWaitForSingleObject _RegisterWaitForSingleObject = NULL
 

Function Documentation

◆ LoadKernel32()

static void LoadKernel32 ( )
static

Definition at line 37 of file mingwcompat.c.

References ereport, errmsg_internal(), FATAL, and kernel32.

Referenced by RegisterWaitForSingleObject().

38 {
39  if (kernel32 != NULL)
40  return;
41 
42  kernel32 = LoadLibraryEx("kernel32.dll", NULL, 0);
43  if (kernel32 == NULL)
44  ereport(FATAL,
45  (errmsg_internal("could not load kernel32.dll: error code %lu",
46  GetLastError())));
47 }
#define FATAL
Definition: elog.h:52
#define ereport(elevel, rest)
Definition: elog.h:122
int errmsg_internal(const char *fmt,...)
Definition: elog.c:827
static HMODULE kernel32
Definition: mingwcompat.c:30

◆ RegisterWaitForSingleObject()

BOOL WINAPI RegisterWaitForSingleObject ( PHANDLE  phNewWaitObject,
HANDLE  hObject,
WAITORTIMERCALLBACK  Callback,
PVOID  Context,
ULONG  dwMilliseconds,
ULONG  dwFlags 
)

Definition at line 60 of file mingwcompat.c.

References _RegisterWaitForSingleObject, ereport, errmsg_internal(), FATAL, kernel32, and LoadKernel32().

Referenced by BackendRun().

66 {
67  if (_RegisterWaitForSingleObject == NULL)
68  {
69  LoadKernel32();
70 
71  _RegisterWaitForSingleObject = (__RegisterWaitForSingleObject)
72  GetProcAddress(kernel32, "RegisterWaitForSingleObject");
73 
74  if (_RegisterWaitForSingleObject == NULL)
75  ereport(FATAL,
76  (errmsg_internal("could not locate RegisterWaitForSingleObject in kernel32.dll: error code %lu",
77  GetLastError())));
78  }
79 
81  (phNewWaitObject, hObject, Callback, Context, dwMilliseconds, dwFlags);
82 }
static void LoadKernel32()
Definition: mingwcompat.c:37
static __RegisterWaitForSingleObject _RegisterWaitForSingleObject
Definition: mingwcompat.c:57
#define FATAL
Definition: elog.h:52
#define ereport(elevel, rest)
Definition: elog.h:122
int errmsg_internal(const char *fmt,...)
Definition: elog.c:827
static HMODULE kernel32
Definition: mingwcompat.c:30

◆ typedef()

typedef ( PHANDLE  ,
HANDLE  ,
WAITORTIMERCALLBACK  ,
PVOID  ,
ULONG  ,
ULONG   
)

Variable Documentation

◆ _RegisterWaitForSingleObject

__RegisterWaitForSingleObject _RegisterWaitForSingleObject = NULL
static

Definition at line 57 of file mingwcompat.c.

Referenced by RegisterWaitForSingleObject().

◆ in6addr_any

const struct in6_addr in6addr_any = {{{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}}

Definition at line 22 of file mingwcompat.c.

Referenced by PerformRadiusTransaction().

◆ kernel32

HMODULE kernel32 = NULL
static

Definition at line 30 of file mingwcompat.c.

Referenced by LoadKernel32(), and RegisterWaitForSingleObject().