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