Skip to content

Commit f81d6dc

Browse files
bulk88mauke
authored andcommitted
small .h trick for faster win32 interp compiles
cl.exe in the terminal is much faster by eye. PERL_CORE only, since CPAN XS assumes the built-in out the box headers/tokens/structs/linker libs selected by p5p decades ago will never change. Since CPAN has been caught doing "-DPERL_CORE" in the past then including p5 core headers, include a provision to enable #include full W32 headers, since it might be difficult to #undef then #include the OS headers a 2nd time with different CPP defines. "#define NONLS" too many core interp .c files need the ANSI/Wide code page apis to special case each .c. Just leave it out for now. A benefit is smaller .pdb or whatever GCC's dbg symbol file format is. So faster debugger startup. Also GCC uncontrollably includes all "#define"s in its symbol disk format (which isnt a separate file, but a many MBs memory mapped data structure embedded into the particular .exe or .dll, on disk, and in VM). Since Perl isn't a Win32 GUI app, keep the GUI APIs out of the compiler if possible and toss the "text" ASAP in the phases of compiling. Whether whole MS .h files are skipped, or CPP discards large chunks of APIs before reaching the C parser/.obj/.pdb files, is implementation specific behaviour by particular MSVCs and Mingw. Our side was completed, in requesting to exclude stuff.
1 parent 3e10517 commit f81d6dc

File tree

2 files changed

+58
-1
lines changed

2 files changed

+58
-1
lines changed

win32/perllib.c

+2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66
* [Frodo on p.73 of _The Lord of the Rings_, I/iii: "Three Is Company"]
77
*/
88
#define PERLIO_NOT_STDIO 0
9+
#define PERL_IN_WIN32_PERLLIB_C
910
#include "EXTERN.h"
1011
#include "perl.h"
1112

1213
#include "XSUB.h"
14+
#include <winuser.h>
1315

1416
#ifdef PERL_IMPLICIT_SYS
1517
#include "win32iop.h"

win32/win32.h

+56-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,62 @@
110110
# define PERL_STATIC_FORCE_INLINE_NO_RET __declspec(noreturn) __forceinline static
111111
#endif
112112

113-
#define WIN32_LEAN_AND_MEAN
113+
#ifdef PERL_CORE
114+
# ifndef PERL_CORE_NO_CPAN_W32_H /* unsanctioned unsupported bypass for CPAN */
115+
# define NOATOM /* GUI IPC RPC strings */
116+
# define NOCLIPBOARD
117+
# define NOCOLOR /* Widget colors */
118+
# define NOCOMM /* Serial ports*/
119+
# define NOCRYPT /* Encryption and employee auth tap cards */
120+
# define NOCTLMGR /* "Control and Dialog routines" */
121+
# define NODEFERWINDOWPOS /* Z index resize app windows */
122+
# define NODRAWTEXT /* Fonts "DrawText() and DT_*" */
123+
# define NOGDI /* wikipedia "Computer_graphics_algorithms" */
124+
# define NOGDICAPMASKS /* PNP Monitors/Screens */
125+
# define NOHELP /* Help engine */
126+
# define NOICONS /* Icon Img Objs */
127+
# define NOIMAGE /* MS .h says #def for perf, but OBSOL/UNIMPL/FUT */
128+
# define NOKANJI
129+
# define NOKERNEL /* MS .h says #def for perf, but OBSOL/UNIMPL/FUT */
130+
# define NOKEYSTATES /* Mouse */
131+
# define NOMB /* popup MessageBox() */
132+
# define NOMCX /* Dialup Modem */
133+
# define NOMEMMGR /* GUI IPC RPC malloc buffers */
134+
# define NOMENUS /* GUI Menu obj */
135+
# define NOMETAFILE /* file format for half rendered graphics */
136+
# define NOMINMAX /* "Macros min(a,b) and max(a,b)" OBSOL/UNIMPL/FUT */
137+
# define NOMSG /* GUI Message loop */
138+
/* #define NONLS "Wide" Code Page conversion APIs */
139+
/* OBSOL/UNIMPL/FUT "OpenFile(), OemToAnsi, AnsiToOem" etc */
140+
# define NOOPENFILE
141+
# define NOPROFILER /* "Profiler interface." OBSOL/UNIMPL/FUT */
142+
# define NOPROXYSTUB /* MS COM DCOM RPC probably, undoced, unimpl */
143+
# define NORASTEROPS /* see NOGDI */
144+
# define NORPC
145+
# define NOSCROLL /* App Window Objs */
146+
# define NOSERVICE /* root/semi kernel service processes */
147+
# define NOSHOWWINDOW /* App Window Objs */
148+
# define NOSOUND
149+
# define NOSYSCOMMANDS /* App Window Objs */
150+
# define NOSYSMETRICS /* Screen resolution */
151+
# define NOTAPE /* Tape drives */
152+
# define NOTEXTMETRIC /* Fonts */
153+
# ifndef PERL_IN_WIN32_PERLLIB_C
154+
# define NOUSER /* high level GUI/IPC/RPC */
155+
# endif
156+
# define NOVIRTUALKEYCODES /* Keyboards */
157+
# define NOWH /* SetWindowsHook */
158+
# ifndef PERL_IN_WIN32_PERLLIB_C
159+
# define NOWINMESSAGES /* GUI Message loop IPC/RPC */
160+
# endif
161+
# define NOWINOFFSETS /* App Window Obj themes */
162+
# define NOWINSTYLES /* App Window Obj themes */
163+
# define OEMRESOURCE /* Mouse cursor file format */
164+
# define VC_EXTRALEAN /* "MFC" VC 2010s or older??? */
165+
# endif
166+
#endif
167+
168+
#define WIN32_LEAN_AND_MEAN /* Day 1 Win32 Perl port, CPAN expects this. */
114169
#include <windows.h>
115170

116171
/*

0 commit comments

Comments
 (0)