cleanup get_arena param-names, mark as May-Change
[p5sagit/p5-mst-13.2.git] / win32 / win32.h
CommitLineData
68dc0745 1/* WIN32.H
2 *
3fadfdf1 3 * (c) 1995 Microsoft Corporation. All rights reserved.
0d130a44 4 * Developed by hip communications inc.
68dc0745 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
5db10396 12#ifndef _WIN32_WINNT
13# define _WIN32_WINNT 0x0400 /* needed for TryEnterCriticalSection() etc. */
14#endif
638eceb6 15
acfe0abc 16#if defined(PERL_IMPLICIT_SYS)
e9ee4811 17# define DYNAMIC_ENV_FETCH
a6c40364 18# define HAS_GETENV_LEN
e9ee4811 19# define prime_env_iter()
ab39fa9d 20# define WIN32IO_IS_STDIO /* don't pull in custom stdio layer */
c5be433b 21# define WIN32SCK_IS_STDSCK /* don't pull in custom wsock layer */
ab39fa9d 22# ifdef PERL_GLOBAL_STRUCT
32e30700 23# error PERL_GLOBAL_STRUCT cannot be defined with PERL_IMPLICIT_SYS
ab39fa9d 24# endif
e5a95ffb 25# define win32_get_privlib PerlEnv_lib_path
ab39fa9d 26# define win32_get_sitelib PerlEnv_sitelib_path
4ea817c6 27# define win32_get_vendorlib PerlEnv_vendorlib_path
9d8a25dc 28#endif
29
a835ef8a 30#ifdef __GNUC__
b7c82df9 31# ifndef __int64 /* some versions seem to #define it already */
32# define __int64 long long
33# endif
db15561c 34# define Win32_Winsock
1c85e96a 35#ifdef __cplusplus
36/* Mingw32 gcc -xc++ objects to __attribute((unused)) at least */
3fadfdf1 37#undef PERL_UNUSED_DECL
38#define PERL_UNUSED_DECL
a835ef8a 39#endif
1c85e96a 40#endif
41
a835ef8a 42
3fadfdf1 43/* Define DllExport akin to perl's EXT,
22239a37 44 * If we are in the DLL or mimicing the DLL for Win95 work round
3fadfdf1 45 * then Export the symbol,
22239a37 46 * otherwise import it.
47 */
48
5db10396 49/* now even GCC supports __declspec() */
50
22239a37 51#if defined(PERLDLL) || defined(WIN95FIX)
852c2e52 52#define DllExport
53/*#define DllExport __declspec(dllexport)*/ /* noises with VC5+sp3 */
3fadfdf1 54#else
22239a37 55#define DllExport __declspec(dllimport)
56#endif
c69f112c 57
0a753a76 58#define WIN32_LEAN_AND_MEAN
59#include <windows.h>
60
fa58a56f 61/*
62 * Bug in winbase.h in mingw-w64 4.4.0-1 at least... they
63 * do #define GetEnvironmentStringsA GetEnvironmentStrings and fail
64 * to declare GetEnvironmentStringsA.
65 */
66#if defined(__MINGW64__) && defined(GetEnvironmentStringsA) && !defined(UNICODE)
67#ifdef __cplusplus
68extern "C" {
69#endif
70#undef GetEnvironmentStringsA
71WINBASEAPI LPCH WINAPI GetEnvironmentStringsA(VOID);
72#define GetEnvironmentStrings GetEnvironmentStringsA
73#ifdef __cplusplus
74}
75#endif
76#endif
77
68dc0745 78#ifdef WIN32_LEAN_AND_MEAN /* C file is NOT a Perl5 original. */
79#define CONTEXT PERL_CONTEXT /* Avoid conflict of CONTEXT defs. */
68dc0745 80#endif /*WIN32_LEAN_AND_MEAN */
0a753a76 81
eda5ff31 82#ifndef TLS_OUT_OF_INDEXES
83#define TLS_OUT_OF_INDEXES (DWORD)0xFFFFFFFF
84#endif
85
0a753a76 86#include <dirent.h>
87#include <io.h>
88#include <process.h>
89#include <stdio.h>
90#include <direct.h>
390b85e7 91#include <stdlib.h>
c623ac67 92#include <stddef.h>
7a1f88ac 93#include <fcntl.h>
390b85e7 94#ifndef EXT
95#include "EXTERN.h"
96#endif
97
c69f112c 98struct tms {
99 long tms_utime;
100 long tms_stime;
101 long tms_cutime;
102 long tms_cstime;
103};
104
b2af26b1 105#ifndef SYS_NMLN
106#define SYS_NMLN 257
107#endif
108
109struct utsname {
110 char sysname[SYS_NMLN];
111 char nodename[SYS_NMLN];
112 char release[SYS_NMLN];
113 char version[SYS_NMLN];
114 char machine[SYS_NMLN];
115};
116
390b85e7 117#ifndef START_EXTERN_C
b3e5c95e 118#undef EXTERN_C
390b85e7 119#ifdef __cplusplus
120# define START_EXTERN_C extern "C" {
121# define END_EXTERN_C }
122# define EXTERN_C extern "C"
123#else
3fadfdf1 124# define START_EXTERN_C
125# define END_EXTERN_C
390b85e7 126# define EXTERN_C
127#endif
128#endif
129
130#define STANDARD_C 1
131#define DOSISH 1 /* no escaping our roots */
132#define OP_BINARY O_BINARY /* mistake in in pp_sys.c? */
0a753a76 133
f3986ebb 134/* Define USE_SOCKETS_AS_HANDLES to enable emulation of windows sockets as
135 * real filehandles. XXX Should always be defined (the other version is untested) */
136#define USE_SOCKETS_AS_HANDLES
137
a7092146 138/* read() and write() aren't transparent for socket handles */
139#define PERL_SOCK_SYSREAD_IS_RECV
140#define PERL_SOCK_SYSWRITE_IS_SEND
141
682fc664 142#define PERL_NO_FORCE_LINK /* no need for PL_force_link_funcs */
a7092146 143
9e5f57de 144/* Define USE_FIXED_OSFHANDLE to fix MSVCRT's _open_osfhandle() on W95.
145 It now uses some black magic to work seamlessly with the DLL CRT and
146 works with MSVC++ 4.0+ or GCC/Mingw32
d67249f4 147 -- BKS 1-24-2000
148 Only use this fix for VC++ 6.x or earlier (and for GCC, which we assume
149 uses MSVCRT.DLL). Later versions use MSVCR70.dll, MSVCR71.dll, etc, which
150 do not require the fix. */
151#if (defined(_M_IX86) && _MSC_VER >= 1000 && _MSC_VER <= 1200) || defined(__MINGW32__)
f3986ebb 152#define USE_FIXED_OSFHANDLE
153#endif
154
6940069f 155/* Define PERL_WIN32_SOCK_DLOAD to have Perl dynamically load the winsock
156 DLL when needed. Don't use if your compiler supports delayloading (ie, VC++ 6.0)
157 -- BKS 5-29-2000 */
158#if !(defined(_M_IX86) && _MSC_VER >= 1200)
159#define PERL_WIN32_SOCK_DLOAD
160#endif
902173a3 161#define ENV_IS_CASELESS
162
479b2847 163#define PIPESOCK_MODE "b" /* pipes, sockets default to binmode */
164
d41de25a 165#ifndef VER_PLATFORM_WIN32_WINDOWS /* VC-2.0 headers don't have this */
f3986ebb 166#define VER_PLATFORM_WIN32_WINDOWS 1
167#endif
168
d41de25a 169#ifndef FILE_SHARE_DELETE /* VC-4.0 headers don't have this */
170#define FILE_SHARE_DELETE 0x00000004
171#endif
172
327c3667 173/* access() mode bits */
174#ifndef R_OK
175# define R_OK 4
176# define W_OK 2
177# define X_OK 1
178# define F_OK 0
179#endif
180
cc236deb 181/* for waitpid() */
182#ifndef WNOHANG
183# define WNOHANG 1
184#endif
185
c44d3fdb 186#define PERL_GET_CONTEXT_DEFINED
187
f3986ebb 188/* Compiler-specific stuff. */
189
654eccd5 190#if defined(_MSC_VER) || defined(__MINGW32__)
191/* VC uses non-standard way to determine the size and alignment if bit-fields */
192/* MinGW will compiler with -mms-bitfields, so should use the same types */
193# define PERL_BITFIELD8 unsigned char
194# define PERL_BITFIELD16 unsigned short
195# define PERL_BITFIELD32 unsigned int
196#endif
197
910dfcc8 198#ifdef __BORLANDC__ /* Borland C++ */
3e3baf6d 199
cb359b41 200#if (__BORLANDC__ <= 0x520)
3e3baf6d 201#define _access access
202#define _chdir chdir
cb359b41 203#endif
204
4ce4f76e 205#define _getpid getpid
26871e0a 206#define wcsicmp _wcsicmp
3e3baf6d 207#include <sys/types.h>
208
84902520 209#ifndef DllMain
210#define DllMain DllEntryPoint
211#endif
212
dd01f956 213#pragma warn -8004 /* "'foo' is assigned a value that is never used" */
214#pragma warn -8008 /* "condition is always true/false" */
215#pragma warn -8012 /* "comparing signed and unsigned values" */
216#pragma warn -8027 /* "functions containing %s are not expanded inline" */
217#pragma warn -8057 /* "parameter 'foo' is never used" */
218#pragma warn -8060 /* "possibly incorrect assignment" */
219#pragma warn -8066 /* "unreachable code" */
220#pragma warn -8071 /* "conversion may lose significant digits" */
221#pragma warn -8080 /* "'foo' is declared but never used" */
3e3baf6d 222
cd183fd9 223/* Borland C thinks that a pointer to a member variable is 12 bytes in size. */
224#define PERL_MEMBER_PTR_SIZE 12
225
1307044d 226#define isnan _isnan
227
910dfcc8 228#endif
3e3baf6d 229
f3986ebb 230#ifdef _MSC_VER /* Microsoft Visual C++ */
231
f4257e4d 232#ifndef UNDER_CE
0a753a76 233typedef long uid_t;
234typedef long gid_t;
a6c40364 235typedef unsigned short mode_t;
f4257e4d 236#endif
237
c623ac67 238#pragma warning(disable: 4102) /* "unreferenced label" */
f3986ebb 239
0f4eea8f 240/* Visual C thinks that a pointer to a member variable is 16 bytes in size. */
cd183fd9 241#define PERL_MEMBER_PTR_SIZE 16
0f4eea8f 242
5fb4d820 243#define isnan _isnan
80e18237 244#define snprintf _snprintf
245#define vsnprintf _vsnprintf
5fb4d820 246
cab190d4 247#if _MSC_VER < 1300
248/* VC6 has broken NaN semantics: NaN == NaN returns true instead of false */
249#define NAN_COMPARE_BROKEN 1
250#endif
251
f3986ebb 252#endif /* _MSC_VER */
253
910dfcc8 254#ifdef __MINGW32__ /* Minimal Gnu-Win32 */
255
256typedef long uid_t;
257typedef long gid_t;
b1d1613b 258#ifndef _environ
3730b96e 259#define _environ environ
b1d1613b 260#endif
3730b96e 261#define flushall _flushall
262#define fcloseall _fcloseall
6940069f 263#define isnan _isnan /* ...same libraries as MSVC */
910dfcc8 264
ac4c12e7 265#ifndef _O_NOINHERIT
266# define _O_NOINHERIT 0x0080
267# ifndef _NO_OLDNAMES
268# define O_NOINHERIT _O_NOINHERIT
269# endif
270#endif
271
8659febc 272/* <stdint.h>, pulled in by <io.h> as of mingw-runtime-3.3, typedef's
273 * (u)intptr_t but doesn't set the _(U)INTPTR_T_DEFINED defines */
274#ifdef _STDINT_H
275# ifndef _INTPTR_T_DEFINED
276# define _INTPTR_T_DEFINED
277# endif
278# ifndef _UINTPTR_T_DEFINED
279# define _UINTPTR_T_DEFINED
280# endif
281#endif
282
910dfcc8 283#endif /* __MINGW32__ */
284
f8fb7c90 285/* both GCC/Mingw32 and MSVC++ 4.0 are missing this, so we put it here */
286#ifndef CP_UTF8
287# define CP_UTF8 65001
288#endif
289
f3986ebb 290/* compatibility stuff for other compilers goes here */
0a753a76 291
c623ac67 292#ifndef _INTPTR_T_DEFINED
293typedef int intptr_t;
294# define _INTPTR_T_DEFINED
295#endif
296
297#ifndef _UINTPTR_T_DEFINED
298typedef unsigned int uintptr_t;
299# define _UINTPTR_T_DEFINED
300#endif
301
390b85e7 302START_EXTERN_C
f3986ebb 303
304/* For UNIX compatibility. */
305
0a753a76 306extern uid_t getuid(void);
307extern gid_t getgid(void);
308extern uid_t geteuid(void);
309extern gid_t getegid(void);
0a753a76 310extern int setuid(uid_t uid);
311extern int setgid(gid_t gid);
312extern int kill(int pid, int sig);
542cb85f 313extern int killpg(int pid, int sig);
c623ac67 314#ifndef USE_PERL_SBRK
315extern void *sbrk(ptrdiff_t need);
316# define HAS_SBRK_PROTO
317#endif
e34ffe5a 318extern char * getlogin(void);
b990f8c8 319extern int chown(const char *p, uid_t o, gid_t g);
00b02797 320extern int mkstemp(const char *path);
d55594ae 321
f3986ebb 322#undef Stat
323#define Stat win32_stat
3e3baf6d 324
f3986ebb 325#undef init_os_extras
326#define init_os_extras Perl_init_os_extras
390b85e7 327
22239a37 328DllExport void Perl_win32_init(int *argcp, char ***argvp);
23f519f0 329DllExport void Perl_win32_term(void);
cb359b41 330DllExport void Perl_init_os_extras(void);
c5be433b 331DllExport void win32_str_os_error(void *sv, DWORD err);
332DllExport int RunPerl(int argc, char **argv, char **env);
0551aaa8 333
635bbe87 334typedef struct {
335 HANDLE childStdIn;
336 HANDLE childStdOut;
337 HANDLE childStdErr;
f83751a7 338 /*
339 * the following correspond to the fields of the same name
340 * in the STARTUPINFO structure. Embedders can use these to
341 * control the spawning process' look.
342 * Example - to hide the window of the spawned process:
343 * dwFlags = STARTF_USESHOWWINDOW;
344 * wShowWindow = SW_HIDE;
345 */
346 DWORD dwFlags;
3fadfdf1 347 DWORD dwX;
348 DWORD dwY;
349 DWORD dwXSize;
350 DWORD dwYSize;
351 DWORD dwXCountChars;
352 DWORD dwYCountChars;
f83751a7 353 DWORD dwFillAttribute;
3fadfdf1 354 WORD wShowWindow;
635bbe87 355} child_IO_table;
356
357DllExport void win32_get_child_IO(child_IO_table* ptr);
b69b0499 358DllExport HWND win32_create_message_window(void);
635bbe87 359
f3986ebb 360#ifndef USE_SOCKETS_AS_HANDLES
361extern FILE * my_fdopen(int, char *);
d55594ae 362#endif
f3986ebb 363extern int my_fclose(FILE *);
c623ac67 364extern int my_fstat(int fd, Stat_t *sbufptr);
e6a0bbf8 365extern char * win32_get_privlib(const char *pl, STRLEN *const len);
366extern char * win32_get_sitelib(const char *pl, STRLEN *const len);
367extern char * win32_get_vendorlib(const char *pl, STRLEN *const len);
f3986ebb 368extern int IsWin95(void);
369extern int IsWinNT(void);
d55594ae 370
1c0ca838 371#ifdef PERL_IMPLICIT_SYS
372extern void win32_delete_internal_host(void *h);
373#endif
374
f3986ebb 375extern char * staticlinkmodules[];
390b85e7 376
377END_EXTERN_C
d55594ae 378
68dc0745 379typedef char * caddr_t; /* In malloc.c (core address). */
0a753a76 380
68dc0745 381/*
68dc0745 382 * handle socket stuff, assuming socket is always available
383 */
0a753a76 384#include <sys/socket.h>
385#include <netdb.h>
386
bbc8f9de 387#ifdef MYMALLOC
388#define EMBEDMYMALLOC /**/
389/* #define USE_PERL_SBRK /**/
390/* #define PERL_SBRK_VIA_MALLOC /**/
391#endif
392
e68cb057 393#ifdef PERL_TEXTMODE_SCRIPTS
c39cd008 394# define PERL_SCRIPT_MODE "r"
a868473f 395#else
c39cd008 396# define PERL_SCRIPT_MODE "rb"
a868473f 397#endif
398
3fadfdf1 399/*
400 * Now Win32 specific per-thread data stuff
3352bfcb 401 */
402
aeecf691 403/* Leave the first couple ids after WM_USER unused because they
404 * might be used by an embedding application, and on Windows
405 * version before 2000 we might end up eating those messages
406 * if they were not meant for us.
407 */
408#define WM_USER_MIN (WM_USER+30)
409#define WM_USER_MESSAGE (WM_USER_MIN)
410#define WM_USER_KILL (WM_USER_MIN+1)
411#define WM_USER_MAX (WM_USER_MIN+1)
412
3352bfcb 413struct thread_intern {
414 /* XXX can probably use one buffer instead of several */
415 char Wstrerror_buffer[512];
416 struct servent Wservent;
417 char Wgetlogin_buffer[128];
f4257e4d 418# ifdef USE_SOCKETS_AS_HANDLES
419 int Winit_socktype;
420# endif
3352bfcb 421# ifdef HAVE_DES_FCRYPT
422 char Wcrypt_buffer[30];
423# endif
424# ifdef USE_RTL_THREAD_API
425 void * retv; /* slot for thread return value */
426# endif
02637f4c 427 BOOL Wuse_showwindow;
428 WORD Wshowwindow;
3352bfcb 429};
430
4b556e6c 431#define HAVE_INTERP_INTERN
0aaad0ff 432typedef struct {
433 long num;
434 DWORD pids[MAXIMUM_WAIT_OBJECTS];
7766f137 435 HANDLE handles[MAXIMUM_WAIT_OBJECTS];
0aaad0ff 436} child_tab;
437
aeecf691 438#ifdef USE_ITHREADS
439typedef struct {
440 long num;
441 DWORD pids[MAXIMUM_WAIT_OBJECTS];
442 HANDLE handles[MAXIMUM_WAIT_OBJECTS];
443 HWND message_hwnds[MAXIMUM_WAIT_OBJECTS];
444} pseudo_child_tab;
445#endif
446
3fadfdf1 447#ifndef Sighandler_t
448typedef Signal_t (*Sighandler_t) (int);
449#define Sighandler_t Sighandler_t
450#endif
451
4b556e6c 452struct interp_intern {
0aaad0ff 453 char * perlshell_tokens;
454 char ** perlshell_vec;
455 long perlshell_items;
456 struct av * fdpid;
457 child_tab * children;
7766f137 458#ifdef USE_ITHREADS
459 DWORD pseudo_id;
aeecf691 460 pseudo_child_tab * pseudo_children;
7766f137 461#endif
462 void * internal_host;
3352bfcb 463 struct thread_intern thr_intern;
aeecf691 464 HWND message_hwnd;
8fb3fcfb 465 UINT timerid;
05ec9bb3 466 unsigned poll_count;
3fadfdf1 467 Sighandler_t sigtable[SIG_SIZE];
4b556e6c 468};
469
8fb3fcfb 470DllExport int win32_async_check(pTHX);
471
05ec9bb3 472#define WIN32_POLL_INTERVAL 32768
8fb3fcfb 473#define PERL_ASYNC_CHECK() if (w32_do_async || PL_sig_pending) win32_async_check(aTHX)
4b556e6c 474
0aaad0ff 475#define w32_perlshell_tokens (PL_sys_intern.perlshell_tokens)
476#define w32_perlshell_vec (PL_sys_intern.perlshell_vec)
477#define w32_perlshell_items (PL_sys_intern.perlshell_items)
478#define w32_fdpid (PL_sys_intern.fdpid)
479#define w32_children (PL_sys_intern.children)
480#define w32_num_children (w32_children->num)
481#define w32_child_pids (w32_children->pids)
7766f137 482#define w32_child_handles (w32_children->handles)
483#define w32_pseudo_id (PL_sys_intern.pseudo_id)
484#define w32_pseudo_children (PL_sys_intern.pseudo_children)
485#define w32_num_pseudo_children (w32_pseudo_children->num)
486#define w32_pseudo_child_pids (w32_pseudo_children->pids)
487#define w32_pseudo_child_handles (w32_pseudo_children->handles)
aeecf691 488#define w32_pseudo_child_message_hwnds (w32_pseudo_children->message_hwnds)
7766f137 489#define w32_internal_host (PL_sys_intern.internal_host)
8fb3fcfb 490#define w32_timerid (PL_sys_intern.timerid)
aeecf691 491#define w32_message_hwnd (PL_sys_intern.message_hwnd)
3fadfdf1 492#define w32_sighandler (PL_sys_intern.sigtable)
05ec9bb3 493#define w32_poll_count (PL_sys_intern.poll_count)
494#define w32_do_async (w32_poll_count++ > WIN32_POLL_INTERVAL)
3db8f154 495#define w32_strerror_buffer (PL_sys_intern.thr_intern.Wstrerror_buffer)
496#define w32_getlogin_buffer (PL_sys_intern.thr_intern.Wgetlogin_buffer)
497#define w32_crypt_buffer (PL_sys_intern.thr_intern.Wcrypt_buffer)
498#define w32_servent (PL_sys_intern.thr_intern.Wservent)
f4257e4d 499#define w32_init_socktype (PL_sys_intern.thr_intern.Winit_socktype)
3db8f154 500#define w32_use_showwindow (PL_sys_intern.thr_intern.Wuse_showwindow)
501#define w32_showwindow (PL_sys_intern.thr_intern.Wshowwindow)
c53bd28a 502
7766f137 503#ifdef USE_ITHREADS
504# define PERL_WAIT_FOR_CHILDREN \
505 STMT_START { \
506 if (w32_pseudo_children && w32_num_pseudo_children) { \
507 long children = w32_num_pseudo_children; \
508 WaitForMultipleObjects(children, \
509 w32_pseudo_child_handles, \
510 TRUE, INFINITE); \
511 while (children) \
512 CloseHandle(w32_pseudo_child_handles[--children]); \
513 } \
514 } STMT_END
515#endif
516
a10b7b7e 517#if defined(USE_FIXED_OSFHANDLE) || defined(PERL_MSVCRT_READFIX)
518#ifdef PERL_CORE
519
520/* C doesn't like repeat struct definitions */
df500c58 521#if defined(__MINGW32__) && (__MINGW32_MAJOR_VERSION>=3)
15689010 522#undef _CRTIMP
523#endif
a10b7b7e 524#ifndef _CRTIMP
525#define _CRTIMP __declspec(dllimport)
526#endif
527
528/*
529 * Control structure for lowio file handles
530 */
531typedef struct {
c623ac67 532 intptr_t osfhnd;/* underlying OS file HANDLE */
a10b7b7e 533 char osfile; /* attributes of file (e.g., open in text mode?) */
534 char pipech; /* one char buffer for handles opened on pipes */
535 int lockinitflag;
536 CRITICAL_SECTION lock;
537} ioinfo;
538
539
540/*
541 * Array of arrays of control structures for lowio files.
542 */
543EXTERN_C _CRTIMP ioinfo* __pioinfo[];
544
545/*
546 * Definition of IOINFO_L2E, the log base 2 of the number of elements in each
547 * array of ioinfo structs.
548 */
549#define IOINFO_L2E 5
550
551/*
552 * Definition of IOINFO_ARRAY_ELTS, the number of elements in ioinfo array
553 */
554#define IOINFO_ARRAY_ELTS (1 << IOINFO_L2E)
555
556/*
557 * Access macros for getting at an ioinfo struct and its fields from a
558 * file handle
559 */
560#define _pioinfo(i) (__pioinfo[(i) >> IOINFO_L2E] + ((i) & (IOINFO_ARRAY_ELTS - 1)))
561#define _osfhnd(i) (_pioinfo(i)->osfhnd)
562#define _osfile(i) (_pioinfo(i)->osfile)
563#define _pipech(i) (_pioinfo(i)->pipech)
564
565/* since we are not doing a dup2(), this works fine */
c623ac67 566#define _set_osfhnd(fh, osfh) (void)(_osfhnd(fh) = (intptr_t)osfh)
a10b7b7e 567#endif
568#endif
569
3fadfdf1 570/* IO.xs and POSIX.xs define PERLIO_NOT_STDIO to 1 */
6e22d046 571#if defined(PERL_EXT_IO) || defined(PERL_EXT_POSIX)
572#undef PERLIO_NOT_STDIO
573#endif
adb71456 574#define PERLIO_NOT_STDIO 0
575
576#include "perlio.h"
577
4f63d024 578/*
579 * This provides a layer of functions and macros to ensure extensions will
580 * get to use the same RTL functions as the core.
581 */
582#include "win32iop.h"
583
b4748376 584#define EXEC_ARGV_CAST(x) ((const char *const *) x)
585
4fb841ef 586#if !defined(ECONNABORTED) && defined(WSAECONNABORTED)
587#define ECONNABORTED WSAECONNABORTED
588#endif
f2b62286 589#if !defined(ECONNRESET) && defined(WSAECONNRESET)
590#define ECONNRESET WSAECONNRESET
591#endif
4fb841ef 592#if !defined(EAFNOSUPPORT) && defined(WSAEAFNOSUPPORT)
593#define EAFNOSUPPORT WSAEAFNOSUPPORT
594#endif
f2b62286 595/* Why not needed for ECONNREFUSED? --abe */
4fb841ef 596
f4958739 597DllExport void *win32_signal_context(void);
1018e26f 598#define PERL_GET_SIG_CONTEXT win32_signal_context()
599
45496817 600#ifdef UNDER_CE
7bd379e8 601#define Win_GetModuleHandle XCEGetModuleHandleA
602#define Win_GetProcAddress XCEGetProcAddressA
603#define Win_GetModuleFileName XCEGetModuleFileNameA
604#define Win_CreateSemaphore CreateSemaphoreW
605#else
606#define Win_GetModuleHandle GetModuleHandle
607#define Win_GetProcAddress GetProcAddress
608#define Win_GetModuleFileName GetModuleFileName
609#define Win_CreateSemaphore CreateSemaphore
610#endif
611
68dc0745 612#endif /* _INC_WIN32_PERL5 */
7a9ec5a3 613