Newer
Older
libj / include / j / os.hpp
Nomura Kei on 22 Jun 2024 1 KB update libj
  1. /**
  2. * @file os.hpp
  3. * @brief J Library OS 関連ヘッダファイル。
  4. * @copyright 2001 - 2024 Nomura Kei
  5. * @depends
  6. *
  7. * Windows の場合、よく利用するヘッダをインクルードします。
  8. */
  9. #ifndef J_OS_HPP
  10. #define J_OS_HPP
  11. #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) || defined(__WIN32__) || defined(WIN64) || defined(_WIN64) || defined(__WIN64) || defined(__WIN64__)
  12. #define IS_WINDOWS (1)
  13.  
  14. // DMC にて winsoc2.h を利用する場合、_WINSOCK_API_ が必要
  15. // 詳細は、下記URL参照
  16. // http://www.digitalmars.com/d/archives/c++/idde/326.html
  17. #ifdef __DMC__
  18. #define _WINSOCKAPI_
  19. #include <sys/types.h>
  20. #endif
  21.  
  22. // サポートする OS バージョン指定として、Windows 10 以降を指定する。
  23. // 参考までに他バージョンの値は次の通り。
  24. // Windows 2000 0x05000
  25. // Windows XP 0x0501
  26. // Windows Server 2003 0x0502
  27. // Windows Server 2008 0x0600
  28. // Windows 7 0x0601
  29. // Windows 8 0x0602
  30. // Windows 10 0x0A00
  31. #ifndef WINVER
  32. #define WINVER 0x0A00
  33. #endif
  34. #ifndef _WIN32_WINNT
  35. #define _WIN32_WINNT 0x0A00
  36. #endif
  37.  
  38. // よく利用されるヘッダファイルをインクルードする
  39. #include <winsock2.h>
  40. #include <ws2tcpip.h>
  41. #include <windows.h>
  42. #include <netioapi.h>
  43. #ifdef _MSC_VER
  44. #pragma comment(lib, "ws2_32.lib")
  45. #pragma comment(lib, "iphlpapi.lib")
  46. #endif
  47.  
  48. #else
  49. // ##### Windows 以外 #####
  50. #define IS_WINDOWS (0)
  51.  
  52. #endif // Windows 判定
  53. #endif // J_OS_HPP