Header And Logo

PostgreSQL
| The world's most advanced open source database.

Defines | Functions

win32.h File Reference

#include "utils/dynamic_loader.h"
Include dependency graph for win32.h:

Go to the source code of this file.

Defines

#define pg_dlopen(f)   dlopen((f), 1)
#define pg_dlsym   dlsym
#define pg_dlclose   dlclose
#define pg_dlerror   dlerror

Functions

char * dlerror (void)
int dlclose (void *handle)
void * dlsym (void *handle, const char *symbol)
void * dlopen (const char *path, int mode)

Define Documentation

#define pg_dlclose   dlclose

Definition at line 11 of file win32.h.

#define pg_dlerror   dlerror

Definition at line 12 of file win32.h.

#define pg_dlopen (   f  )     dlopen((f), 1)

Definition at line 9 of file win32.h.

#define pg_dlsym   dlsym

Definition at line 10 of file win32.h.


Function Documentation

int dlclose ( void *  handle  ) 

Definition at line 41 of file win32.c.

References last_dyn_error, and set_dl_error().

Referenced by BSD44_derived_dlclose().

{
    if (!FreeLibrary((HMODULE) handle))
    {
        set_dl_error();
        return 1;
    }
    last_dyn_error[0] = 0;
    return 0;
}

char* dlerror ( void   ) 

Definition at line 32 of file win32.c.

References last_dyn_error.

Referenced by BSD44_derived_dlopen().

{
    if (last_dyn_error[0])
        return last_dyn_error;
    else
        return NULL;
}

void* dlopen ( const char *  path,
int  mode 
)

Definition at line 68 of file win32.c.

References last_dyn_error, and set_dl_error().

Referenced by BSD44_derived_dlopen().

{
    HMODULE     h;
    int         prevmode;

    /* Disable popup error messages when loading DLLs */
    prevmode = SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
    h = LoadLibrary(path);
    SetErrorMode(prevmode);

    if (!h)
    {
        set_dl_error();
        return NULL;
    }
    last_dyn_error[0] = 0;
    return (void *) h;
}

void* dlsym ( void *  handle,
const char *  symbol 
)

Definition at line 53 of file win32.c.

References last_dyn_error, and set_dl_error().

Referenced by BSD44_derived_dlsym().

{
    void       *ptr;

    ptr = GetProcAddress((HMODULE) handle, symbol);
    if (!ptr)
    {
        set_dl_error();
        return NULL;
    }
    last_dyn_error[0] = 0;
    return ptr;
}