Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit62636a3

Browse files
committed
Re-add Win32 missing files, I think.
1 parenta89660a commit62636a3

File tree

2 files changed

+126
-0
lines changed

2 files changed

+126
-0
lines changed

‎src/utils/Makefile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#-------------------------------------------------------------------------
2+
#
3+
# Makefile for utils
4+
#
5+
# $Header: /cvsroot/pgsql/src/utils/Attic/Makefile,v 1.19 2002/11/02 02:00:35 momjian Exp $
6+
#
7+
# dllinit.o is only built on Win32 platform.
8+
#
9+
#-------------------------------------------------------------------------
10+
11+
subdir = src/utils
12+
top_builddir = ../..
13+
include$(top_builddir)/src/Makefile.global
14+
15+
all:
16+
17+
cleandistcleanmaintainer-clean:
18+
rm -f dllinit.o

‎src/utils/dllinit.c

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
#include<cygwin/version.h>
2+
#ifCYGWIN_VERSION_DLL_MAJOR<1001
3+
4+
/* dllinit.c -- Portable DLL initialization.
5+
Copyright (C) 1998 Free Software Foundation, Inc.
6+
Contributed by Mumit Khan (khan@xraylith.wisc.edu).
7+
8+
I've used DllMain as the DLL "main" since that's the most common
9+
usage. MSVC and Mingw32 both default to DllMain as the standard
10+
callback from the linker entry point. Cygwin32 b19+ uses essentially
11+
the same, albeit slightly differently implemented, scheme. Please
12+
see DECLARE_CYGWIN_DLL macro in <cygwin32/cygwin_dll.h> for more
13+
info on how Cygwin32 uses the callback function.
14+
15+
The real entry point is typically always defined by the runtime
16+
library, and usually never overridden by (casual) user. What you can
17+
override however is the callback routine that the entry point calls,
18+
and this file provides such a callback function, DllMain.
19+
20+
Mingw32: The default entry point for mingw32 is DllMainCRTStartup
21+
which is defined in libmingw32.a This in turn calls DllMain which is
22+
defined here. If not defined, there is a stub in libmingw32.a which
23+
does nothing.
24+
25+
Cygwin32: The default entry point for cygwin32 b19 or newer is
26+
__cygwin32_dll_entry which is defined in libcygwin.a. This in turn
27+
calls the routine you supply to the DECLARE_CYGWIN_DLL (see below)
28+
and, for this example, I've chose DllMain to be consistent with all
29+
the other platforms.
30+
31+
MSVC: MSVC runtime calls DllMain, just like Mingw32.
32+
33+
Summary: If you need to do anything special in DllMain, just add it
34+
here. Otherwise, the default setup should be just fine for 99%+ of
35+
the time. I strongly suggest that you *not* change the entry point,
36+
but rather change DllMain as appropriate.
37+
38+
*/
39+
40+
41+
#defineWIN32_LEAN_AND_MEAN
42+
#include<windows.h>
43+
#undef WIN32_LEAN_AND_MEAN
44+
#include<stdio.h>
45+
46+
BOOLAPIENTRYDllMain(HINSTANCEhInst,DWORDreason,
47+
LPVOIDreserved/* Not used. */ );
48+
49+
#ifdef__CYGWIN__
50+
51+
#include<cygwin/cygwin_dll.h>
52+
DECLARE_CYGWIN_DLL(DllMain);
53+
/* save hInstance from DllMain */
54+
HINSTANCE__hDllInstance_base;
55+
#endif/* __CYGWIN__ */
56+
57+
struct_reent*_impure_ptr;
58+
59+
externstruct_reent*__imp_reent_data;
60+
61+
/*
62+
*----------------------------------------------------------------------
63+
*
64+
* DllMain
65+
*
66+
*This routine is called by the Mingw32, Cygwin32 or VC++ C run
67+
*time library init code, or the Borland DllEntryPoint routine. It
68+
*is responsible for initializing various dynamically loaded
69+
*libraries.
70+
*
71+
* Results:
72+
*TRUE on sucess, FALSE on failure.
73+
*
74+
* Side effects:
75+
*
76+
*----------------------------------------------------------------------
77+
*/
78+
BOOLAPIENTRY
79+
DllMain(
80+
HINSTANCEhInst/* Library instance handle. */ ,
81+
DWORDreason/* Reason this function is being called. */ ,
82+
LPVOIDreserved/* Not used. */ )
83+
{
84+
85+
#ifdef__CYGWIN__
86+
__hDllInstance_base=hInst;
87+
#endif/* __CYGWIN__ */
88+
89+
_impure_ptr=__imp_reent_data;
90+
91+
switch (reason)
92+
{
93+
caseDLL_PROCESS_ATTACH:
94+
break;
95+
96+
caseDLL_PROCESS_DETACH:
97+
break;
98+
99+
caseDLL_THREAD_ATTACH:
100+
break;
101+
102+
caseDLL_THREAD_DETACH:
103+
break;
104+
}
105+
return TRUE;
106+
}
107+
108+
#endif/* CYGWIN_VERSION_DLL_MAJOR < 1001 */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp