Newer
Older
libkcpp / modules / include / kcpp_os.hpp
/**
 * @file kcpp_os.h
 * @brief Kantan C++ Library OS 関連ヘッダファイル。
 * @copyright  2001 - 2024  Nomura Kei
 * @depends
 *
 *
 * Windows の場合、よく利用するヘッダをインクルードします。
 */
#ifndef KCPP_OS_HPP
#define KCPP_OS_HPP
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) || defined(__WIN32__) || defined(WIN64) || defined(_WIN64) || defined(__WIN64) || defined(__WIN64__)
#define IS_WINDOWS (1)

// DMC にて winsoc2.h を利用する場合、_WINSOCK_API_ が必要
// 詳細は、下記URL参照
// http://www.digitalmars.com/d/archives/c++/idde/326.html
#ifdef __DMC__
#define _WINSOCKAPI_
#include <sys/types.h>
#endif

// サポートする OS バージョン指定として、Windows 10 以降を指定する。
// 参考までに他バージョンの値は次の通り。
// Windows 2000         0x05000
// Windows XP           0x0501
// Windows Server 2003  0x0502
// Windows Server 2008  0x0600
// Windows 7            0x0601
// Windows 8            0x0602
// Windows 10           0x0A00
#ifndef WINVER
#define WINVER 0x0A00
#endif
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0A00
#endif

// よく利用されるヘッダファイルをインクルードする
#include <winsock2.h>
#include <ws2tcpip.h>
#include <windows.h>
#include <netioapi.h>
#ifdef _MSC_VER
#pragma comment(lib, "ws2_32.lib")
#pragma comment(lib, "iphlpapi.lib")
#endif

#else
// ##### Windows 以外 #####
#define IS_WINDOWS (0)

#endif // Windows 判定
#endif // KCPP_OS_HPP