mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-09-28 06:41:49 +02:00
Add missing Windows files.
This commit is contained in:
parent
d3423daaee
commit
909c519733
4
src/backend/port/dynloader/win.c
Normal file
4
src/backend/port/dynloader/win.c
Normal file
@ -0,0 +1,4 @@
|
||||
/* Dummy file used for nothing at this point
|
||||
*
|
||||
* see win.h
|
||||
*/
|
34
src/backend/port/dynloader/win.h
Normal file
34
src/backend/port/dynloader/win.h
Normal file
@ -0,0 +1,34 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* win.h--
|
||||
* port-specific prototypes for Intel x86/Window NT
|
||||
*
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* win.h,v 1.2 1995/03/17 06:40:18 andrew Exp
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef PORT_PROTOS_H
|
||||
#define PORT_PROTOS_H
|
||||
|
||||
#include <dlfcn.h>
|
||||
#include "fmgr.h" /* for func_ptr */
|
||||
#include "utils/dynamic_loader.h"
|
||||
|
||||
/* dynloader.c */
|
||||
/*
|
||||
* Dynamic Loader on Intel x86/Windows NT
|
||||
*
|
||||
* this dynamic loader uses the system dynamic loading interface for shared
|
||||
* libraries (ie. dlopen/dlsym/dlclose). The user must specify a shared
|
||||
* library as the file to be dynamically loaded.
|
||||
*
|
||||
*/
|
||||
#define pg_dlopen(f) dlopen(f,1)
|
||||
#define pg_dlsym dlsym
|
||||
#define pg_dlclose dlclose
|
||||
#define pg_dlerror dlerror
|
||||
|
||||
#endif /* PORT_PROTOS_H */
|
7
src/include/port/win.h
Normal file
7
src/include/port/win.h
Normal file
@ -0,0 +1,7 @@
|
||||
#define JMP_BUF
|
||||
#define HAS_TEST_AND_SET
|
||||
typedef unsigned char slock_t;
|
||||
|
||||
#ifndef O_DIROPEN
|
||||
#define O_DIROPEN 0x100000 /* should be in sys/fcntl.h */
|
||||
#endif
|
15
src/makefiles/Makefile.win
Normal file
15
src/makefiles/Makefile.win
Normal file
@ -0,0 +1,15 @@
|
||||
CFLAGS+= -I/usr/local/include
|
||||
LDFLAGS+= -g
|
||||
DLLTOOL= dlltool
|
||||
DLLWRAP= dllwrap
|
||||
DLLLIBS=-L/usr/local/lib -L$(LIBDIR) -L$(SRCDIR)/backend -lpostgres -lcygipc -lcygwin -lcrypt -lkernel32
|
||||
X=.exe
|
||||
MK_NO_LORDER=true
|
||||
MAKE_DLL=true
|
||||
#MAKE_DLL=false
|
||||
SHLIB_LINK=$(DLLLIBS)
|
||||
|
||||
%.dll: %.o
|
||||
$(DLLTOOL) --export-all --output-def $*.def $<
|
||||
$(DLLWRAP) -o $@ --def $*.def $< $(SRCDIR)/utils/dllinit.o $(DLLLIBS)
|
||||
rm -f $*.def
|
11
src/template/cygwin32
Normal file
11
src/template/cygwin32
Normal file
@ -0,0 +1,11 @@
|
||||
AROPT:crs
|
||||
CFLAGS:-O2 -g
|
||||
SHARED_LIB:
|
||||
ALL:
|
||||
SRCH_INC:/usr/local/include
|
||||
SRCH_LIB:/usr/local/lib
|
||||
USE_LOCALE:no
|
||||
DLSUFFIX:.dll
|
||||
YFLAGS:-d -L /sw/cygwin-b20/share/
|
||||
YACC:
|
||||
LIBS:-lcygipc
|
105
src/utils/dllinit.c
Normal file
105
src/utils/dllinit.c
Normal file
@ -0,0 +1,105 @@
|
||||
/* dllinit.c -- Portable DLL initialization.
|
||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
Contributed by Mumit Khan (khan@xraylith.wisc.edu).
|
||||
|
||||
I've used DllMain as the DLL "main" since that's the most common
|
||||
usage. MSVC and Mingw32 both default to DllMain as the standard
|
||||
callback from the linker entry point. Cygwin32 b19+ uses essentially
|
||||
the same, albeit slightly differently implemented, scheme. Please
|
||||
see DECLARE_CYGWIN_DLL macro in <cygwin32/cygwin_dll.h> for more
|
||||
info on how Cygwin32 uses the callback function.
|
||||
|
||||
The real entry point is typically always defined by the runtime
|
||||
library, and usually never overridden by (casual) user. What you can
|
||||
override however is the callback routine that the entry point calls,
|
||||
and this file provides such a callback function, DllMain.
|
||||
|
||||
Mingw32: The default entry point for mingw32 is DllMainCRTStartup
|
||||
which is defined in libmingw32.a This in turn calls DllMain which is
|
||||
defined here. If not defined, there is a stub in libmingw32.a which
|
||||
does nothing.
|
||||
|
||||
Cygwin32: The default entry point for cygwin32 b19 or newer is
|
||||
__cygwin32_dll_entry which is defined in libcygwin.a. This in turn
|
||||
calls the routine you supply to the DECLARE_CYGWIN_DLL (see below)
|
||||
and, for this example, I've chose DllMain to be consistent with all
|
||||
the other platforms.
|
||||
|
||||
MSVC: MSVC runtime calls DllMain, just like Mingw32.
|
||||
|
||||
Summary: If you need to do anything special in DllMain, just add it
|
||||
here. Otherwise, the default setup should be just fine for 99%+ of
|
||||
the time. I strongly suggest that you *not* change the entry point,
|
||||
but rather change DllMain as appropriate.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
#include <stdio.h>
|
||||
|
||||
BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason,
|
||||
LPVOID reserved /* Not used. */ );
|
||||
|
||||
#ifdef __CYGWIN32__
|
||||
|
||||
#include <cygwin/cygwin_dll.h>
|
||||
DECLARE_CYGWIN_DLL( DllMain );
|
||||
/* save hInstance from DllMain */
|
||||
HINSTANCE __hDllInstance_base;
|
||||
|
||||
#endif /* __CYGWIN32__ */
|
||||
|
||||
struct _reent *_impure_ptr;
|
||||
|
||||
extern struct _reent *__imp_reent_data;
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* DllMain --
|
||||
*
|
||||
* This routine is called by the Mingw32, Cygwin32 or VC++ C run
|
||||
* time library init code, or the Borland DllEntryPoint routine. It
|
||||
* is responsible for initializing various dynamically loaded
|
||||
* libraries.
|
||||
*
|
||||
* Results:
|
||||
* TRUE on sucess, FALSE on failure.
|
||||
*
|
||||
* Side effects:
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
BOOL APIENTRY
|
||||
DllMain (
|
||||
HINSTANCE hInst /* Library instance handle. */ ,
|
||||
DWORD reason /* Reason this function is being called. */ ,
|
||||
LPVOID reserved /* Not used. */ )
|
||||
{
|
||||
|
||||
#ifdef __CYGWIN32__
|
||||
__hDllInstance_base = hInst;
|
||||
#endif /* __CYGWIN32__ */
|
||||
|
||||
_impure_ptr = __imp_reent_data;
|
||||
|
||||
switch (reason)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
break;
|
||||
|
||||
case DLL_PROCESS_DETACH:
|
||||
break;
|
||||
|
||||
case DLL_THREAD_ATTACH:
|
||||
break;
|
||||
|
||||
case DLL_THREAD_DETACH:
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user