SMBIOS Library
win64.hpp
Go to the documentation of this file.
1 // (C) Copyright John Maddock 2001 - 2003.
2 // (C) Copyright Bill Kempf 2001.
3 // (C) Copyright Aleksey Gurtovoy 2003.
4 // Use, modification and distribution are subject to the
5 // Boost Software License, Version 1.0. (See accompanying file
6 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 
8 // See http://www.boost.org for most recent version.
9 
10 // Win32 specific config options:
11 
12 #define LIBSMBIOS_PLATFORM "Win32"
13 #define LIBSMBIOS_PLATFORM_WIN32
14 
15 // Windows has a special platform-specific smbios table accessor method
16 // that can be used if generic memory access fails.
17 #define LIBSMBIOS_HAS_ARCH_TABLE_CLASS
18 
19 // Enable 64-bit file access (changes off_t to 64-bit)
20 #define FSEEK(fh, pos, whence) fseek(fh, static_cast<long>(pos), whence)
21 
22 #if defined(__GNUC__) && !defined(LIBSMBIOS_NO_SWPRINTF)
23 # define LIBSMBIOS_NO_SWPRINTF
24 #endif
25 
26 #if !defined(__GNUC__) && !defined(LIBSMBIOS_HAS_DECLSPEC)
27 # define LIBSMBIOS_HAS_DECLSPEC
28 #endif
29 
30 #if defined(__MINGW32__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 2)))
31 # define LIBSMBIOS_HAS_STDINT_H
32 # define __STDC_LIMIT_MACROS
33 #endif
34 
35 // workaround for broken namespace on win64 compiler
36 #define LIBSMBIOS_NO_STDC_NAMESPACE
37 
38 //
39 // Win32 will normally be using native Win32 threads,
40 // but there is a pthread library available as an option,
41 // we used to disable this when LIBSMBIOS_DISABLE_WIN32 was
42 // defined but no longer - this should allow some
43 // files to be compiled in strict mode - while maintaining
44 // a consistent setting of LIBSMBIOS_HAS_THREADS across
45 // all translation units (needed for shared_ptr etc).
46 //
47 #ifndef LIBSMBIOS_HAS_PTHREADS
48 # define LIBSMBIOS_HAS_WINTHREADS
49 #endif
50 
51 #ifndef LIBSMBIOS_DISABLE_WIN32
52 // WEK: Added
53 #define LIBSMBIOS_HAS_FTIME
54 
55 #endif
56 
57 //
58 // disable min/max macros:
59 //
60 #ifdef min
61 # undef min
62 #endif
63 #ifdef max
64 # undef max
65 #endif
66 #ifndef NOMINMAX
67 # define NOMINMAX
68 #endif
69 
70 #ifdef LIBSMBIOS_MSVC
71 #include <algorithm> // for existing std::min and std::max
72 namespace std{
73  // Apparently, something in the Microsoft libraries requires the "long"
74  // overload, because it calls the min/max functions with arguments of
75  // slightly different type. (If this proves to be incorrect, this
76  // whole "LIBSMBIOS_MSVC" section can be removed.)
77  inline long min(long __a, long __b) {
78  return __b < __a ? __b : __a;
79  }
80  inline long max(long __a, long __b) {
81  return __a < __b ? __b : __a;
82  }
83  // The "long double" overload is required, otherwise user code calling
84  // min/max for floating-point numbers will use the "long" overload.
85  // (SourceForge bug #495495)
86  inline long double min(long double __a, long double __b) {
87  return __b < __a ? __b : __a;
88  }
89  inline long double max(long double __a, long double __b) {
90  return __a < __b ? __b : __a;
91  }
92 }
93 using std::min;
94 using std::max;
95 # endif
96 
97