3 * (c) 1995 Microsoft Corporation. All rights reserved.
4 * Developed by hip communications inc., http://info.hip.com/info/
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.
9 #ifndef _INC_WIN32_PERL5
10 #define _INC_WIN32_PERL5
13 typedef long long __int64;
15 /* GCC does not do __declspec() - render it a nop
16 * and turn on options to avoid importing data
19 #define PERL_GLOBAL_STRUCT
23 /* Define DllExport akin to perl's EXT,
24 * If we are in the DLL or mimicing the DLL for Win95 work round
25 * then Export the symbol,
26 * otherwise import it.
29 #if defined(PERLDLL) || defined(WIN95FIX)
30 #define DllExport __declspec(dllexport)
32 #define DllExport __declspec(dllimport)
35 #define WIN32_LEAN_AND_MEAN
38 #ifdef WIN32_LEAN_AND_MEAN /* C file is NOT a Perl5 original. */
39 #define CONTEXT PERL_CONTEXT /* Avoid conflict of CONTEXT defs. */
40 #define index strchr /* Why 'index'? */
41 #endif /*WIN32_LEAN_AND_MEAN */
60 #ifndef START_EXTERN_C
62 # define START_EXTERN_C extern "C" {
63 # define END_EXTERN_C }
64 # define EXTERN_C extern "C"
66 # define START_EXTERN_C
73 #define DOSISH 1 /* no escaping our roots */
74 #define OP_BINARY O_BINARY /* mistake in in pp_sys.c? */
76 /* Define USE_SOCKETS_AS_HANDLES to enable emulation of windows sockets as
77 * real filehandles. XXX Should always be defined (the other version is untested) */
78 #define USE_SOCKETS_AS_HANDLES
80 /* if USE_WIN32_RTL_ENV is not defined, Perl uses direct Win32 calls
81 * to read the environment, bypassing the runtime's (usually broken)
82 * facilities for accessing the same. See note in util.c/my_setenv(). */
83 /*#define USE_WIN32_RTL_ENV */
85 /* Define USE_FIXED_OSFHANDLE to fix VC's _open_osfhandle() on W95.
86 * Can only enable it if not using the DLL CRT (it doesn't expose internals) */
87 #if defined(_MSC_VER) && !defined(_DLL) && defined(_M_IX86)
88 #define USE_FIXED_OSFHANDLE
91 #ifndef VER_PLATFORM_WIN32_WINDOWS /* VC-2.0 headers dont have this */
92 #define VER_PLATFORM_WIN32_WINDOWS 1
95 /* Compiler-specific stuff. */
97 #ifdef __BORLANDC__ /* Borland C++ */
99 #define _access access
101 #include <sys/types.h>
104 #define DllMain DllEntryPoint
119 #ifdef _MSC_VER /* Microsoft Visual C++ */
123 #pragma warning(disable: 4018 4035 4101 4102 4244 4245 4761)
125 #endif /* _MSC_VER */
127 #ifdef __MINGW32__ /* Minimal Gnu-Win32 */
132 #endif /* __MINGW32__ */
134 /* compatibility stuff for other compilers goes here */
139 /* For UNIX compatibility. */
141 extern uid_t getuid(void);
142 extern gid_t getgid(void);
143 extern uid_t geteuid(void);
144 extern gid_t getegid(void);
145 extern int setuid(uid_t uid);
146 extern int setgid(gid_t gid);
147 extern int kill(int pid, int sig);
148 extern void *sbrk(int need);
151 #define Stat win32_stat
153 #undef init_os_extras
154 #define init_os_extras Perl_init_os_extras
156 DllExport void Perl_win32_init(int *argcp, char ***argvp);
157 DllExport void Perl_init_os_extras(void);
159 #ifndef USE_SOCKETS_AS_HANDLES
160 extern FILE * my_fdopen(int, char *);
162 extern int my_fclose(FILE *);
163 extern int do_aspawn(void* really, void ** mark, void ** arglast);
164 extern int do_spawn(char *cmd);
165 extern char do_exec(char *cmd);
166 extern char * win32PerlLibPath(char *sfx,...);
167 extern int IsWin95(void);
168 extern int IsWinNT(void);
170 extern char * staticlinkmodules[];
174 typedef char * caddr_t; /* In malloc.c (core address). */
177 * handle socket stuff, assuming socket is always available
179 #include <sys/socket.h>
183 #define EMBEDMYMALLOC /**/
184 /* #define USE_PERL_SBRK /**/
185 /* #define PERL_SBRK_VIA_MALLOC /**/
188 #if defined(PERLDLL) && !defined(PERL_CORE)
192 #ifdef USE_BINMODE_SCRIPTS
193 #define PERL_SCRIPT_MODE "rb"
194 EXT void win32_strip_return(struct sv *sv);
196 #define PERL_SCRIPT_MODE "r"
197 #define win32_strip_return(sv) NOOP
201 * Now Win32 specific per-thread data stuff
205 #ifndef USE_DECLSPEC_THREAD
206 #define HAVE_THREAD_INTERN
210 char Wstrerror_buffer[512];
211 struct servent Wservent;
216 #endif /* _INC_WIN32_PERL5 */