This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[win32] Fixup the places where the automatic merge got it wrong.
[perl5.git] / win32 / win32.h
CommitLineData
68dc0745
PP
1/* WIN32.H
2 *
3 * (c) 1995 Microsoft Corporation. All rights reserved.
4 * Developed by hip communications inc., http://info.hip.com/info/
5 *
6 * You may distribute under the terms of either the GNU General Public
7 * License or the Artistic License, as specified in the README file.
8 */
0a753a76
PP
9#ifndef _INC_WIN32_PERL5
10#define _INC_WIN32_PERL5
11
12#define WIN32_LEAN_AND_MEAN
13#include <windows.h>
14
68dc0745
PP
15#ifdef WIN32_LEAN_AND_MEAN /* C file is NOT a Perl5 original. */
16#define CONTEXT PERL_CONTEXT /* Avoid conflict of CONTEXT defs. */
17#define index strchr /* Why 'index'? */
18#endif /*WIN32_LEAN_AND_MEAN */
0a753a76
PP
19
20#include <dirent.h>
21#include <io.h>
22#include <process.h>
23#include <stdio.h>
24#include <direct.h>
390b85e7
GS
25#include <stdlib.h>
26#ifndef EXT
27#include "EXTERN.h"
28#endif
29
30#ifndef START_EXTERN_C
31#ifdef __cplusplus
32# define START_EXTERN_C extern "C" {
33# define END_EXTERN_C }
34# define EXTERN_C extern "C"
35#else
36# define START_EXTERN_C
37# define END_EXTERN_C
38# define EXTERN_C
39#endif
40#endif
41
42#define STANDARD_C 1
43#define DOSISH 1 /* no escaping our roots */
44#define OP_BINARY O_BINARY /* mistake in in pp_sys.c? */
f3986ebb
GS
45#define DllExport __declspec(dllexport)
46#define DllImport __declspec(dllimport)
0a753a76 47
f3986ebb
GS
48/* Define USE_SOCKETS_AS_HANDLES to enable emulation of windows sockets as
49 * real filehandles. XXX Should always be defined (the other version is untested) */
50#define USE_SOCKETS_AS_HANDLES
51
52/* if USE_WIN32_RTL_ENV is not defined, Perl uses direct Win32 calls
53 * to read the environment, bypassing the runtime's (usually broken)
54 * facilities for accessing the same. See note in util.c/my_setenv(). */
55/*#define USE_WIN32_RTL_ENV */
0a753a76 56
f3986ebb
GS
57/* Define USE_FIXED_OSFHANDLE to fix VC's _open_osfhandle() on W95.
58 * Can only enable it if not using the DLL CRT (it doesn't expose internals) */
59#if defined(_MSC_VER) && !defined(_DLL) && defined(_M_IX86)
60#define USE_FIXED_OSFHANDLE
61#endif
62
63#ifndef VER_PLATFORM_WIN32_WINDOWS /* VC-2.0 headers dont have this */
64#define VER_PLATFORM_WIN32_WINDOWS 1
65#endif
66
67/* Compiler-specific stuff. */
68
69#ifdef __BORLANDC__ /* Microsoft Visual C++ */
3e3baf6d
TB
70
71#define _access access
72#define _chdir chdir
73#include <sys/types.h>
74
84902520
TB
75#ifndef DllMain
76#define DllMain DllEntryPoint
77#endif
78
3e3baf6d
TB
79#pragma warn -ccc
80#pragma warn -rch
81#pragma warn -sig
82#pragma warn -pia
83#pragma warn -par
84#pragma warn -aus
85#pragma warn -use
86#pragma warn -csu
87#pragma warn -pro
88
89#else
90
f3986ebb
GS
91#ifdef _MSC_VER /* Microsoft Visual C++ */
92
0a753a76
PP
93typedef long uid_t;
94typedef long gid_t;
f3986ebb
GS
95#pragma warning(disable: 4018 4035 4101 4102 4244 4245 4761)
96
97#endif /* _MSC_VER */
98
99/* compatibility stuff for other compilers goes here */
0a753a76 100
3e3baf6d 101#endif
0a753a76 102
390b85e7 103START_EXTERN_C
f3986ebb
GS
104
105/* For UNIX compatibility. */
106
0a753a76
PP
107extern uid_t getuid(void);
108extern gid_t getgid(void);
109extern uid_t geteuid(void);
110extern gid_t getegid(void);
0a753a76
PP
111extern int setuid(uid_t uid);
112extern int setgid(gid_t gid);
113extern int kill(int pid, int sig);
161b471a 114extern void *sbrk(int need);
d55594ae 115
f3986ebb
GS
116#undef Stat
117#define Stat win32_stat
3e3baf6d 118
f3986ebb
GS
119#undef init_os_extras
120#define init_os_extras Perl_init_os_extras
390b85e7 121
f3986ebb
GS
122EXT void Perl_win32_init(int *argcp, char ***argvp);
123EXT void Perl_init_os_extras(void);
0551aaa8 124
f3986ebb
GS
125#ifndef USE_SOCKETS_AS_HANDLES
126extern FILE * my_fdopen(int, char *);
d55594ae 127#endif
f3986ebb
GS
128extern int my_fclose(FILE *);
129extern int do_aspawn(void* really, void ** mark, void ** arglast);
130extern int do_spawn(char *cmd);
131extern char do_exec(char *cmd);
acbc2db6 132extern char * win32PerlLibPath(char *sfx,...);
f3986ebb
GS
133extern int IsWin95(void);
134extern int IsWinNT(void);
d55594ae 135
f3986ebb 136extern char * staticlinkmodules[];
390b85e7
GS
137
138END_EXTERN_C
d55594ae 139
68dc0745 140typedef char * caddr_t; /* In malloc.c (core address). */
0a753a76 141
68dc0745 142/*
68dc0745
PP
143 * handle socket stuff, assuming socket is always available
144 */
0a753a76
PP
145#include <sys/socket.h>
146#include <netdb.h>
147
bbc8f9de
NIS
148#ifdef MYMALLOC
149#define EMBEDMYMALLOC /**/
150/* #define USE_PERL_SBRK /**/
151/* #define PERL_SBRK_VIA_MALLOC /**/
152#endif
153
154#ifdef PERLDLL
155#define PERL_CORE
156#endif
157
a868473f
NIS
158#ifdef USE_BINMODE_SCRIPTS
159#define PERL_SCRIPT_MODE "rb"
160EXT void win32_strip_return(struct sv *sv);
161#else
162#define PERL_SCRIPT_MODE "r"
163#define win32_strip_return(sv) NOOP
164#endif
165
68dc0745 166#endif /* _INC_WIN32_PERL5 */