xapian-core  1.4.26
safewindows.h
Go to the documentation of this file.
1 
4 /* Copyright (C) 2005,2007,2013,2020 Olly Betts
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; either version 2 of the
9  * License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19  * MA 02110-1301, USA
20  */
21 
22 #ifndef XAPIAN_INCLUDED_SAFEWINDOWS_H
23 #define XAPIAN_INCLUDED_SAFEWINDOWS_H
24 
25 #if !defined __CYGWIN__ && !defined __WIN32__
26 # error Including safewindows.h, but neither __CYGWIN__ nor __WIN32__ defined!
27 #endif
28 
29 // Prevent windows.h from defining min and max macros.
30 #ifndef NOMINMAX
31 # define NOMINMAX
32 #endif
33 
34 // Prevent windows.h from including lots of obscure win32 api headers
35 // which we don't care about and will just slow down compilation and
36 // increase the risk of symbol collisions.
37 #define WIN32_LEAN_AND_MEAN
38 #define NOGDI
39 #include <windows.h>
40 
41 // The mingw headers don't reach <winerror.h> from <windows.h> (verified
42 // with w32api 5.4.1). MSVC does, so we treat this as a flaw to workaround and
43 // include <winerror.h> if we detect it hasn't been implicitly included.
44 #ifndef ERROR_PIPE_CONNECTED
45 # include <winerror.h>
46 #endif
47 
48 #endif // XAPIAN_INCLUDED_SAFEWINDOWS_H