From 993cfb64bcc2910e3bd6a4d3ed736b1d68122b2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franz=20P=C3=B6schel?= Date: Tue, 27 Apr 2021 10:03:45 +0200 Subject: [PATCH] Windows compatibility --- src/ChunkInfo.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/ChunkInfo.cpp b/src/ChunkInfo.cpp index ac60047005..eb606caf6b 100644 --- a/src/ChunkInfo.cpp +++ b/src/ChunkInfo.cpp @@ -26,9 +26,13 @@ #include #include #include -#include #include +#ifdef _WIN32 +#else +#include +#endif + namespace openPMD { ChunkInfo::ChunkInfo( Offset offset_in, Extent extent_in ) @@ -569,7 +573,10 @@ chunk_assignment::RankMeta byMethodCollective( MPI_Comm comm, Method method ) std::string hostname() { char hostname[ MAX_HOSTNAME_LENGTH ]; - gethostname( hostname, MAX_HOSTNAME_LENGTH ); + if( gethostname( hostname, MAX_HOSTNAME_LENGTH ) ) + { + throw std::runtime_error( "[gethostname] Could not inquire hostname." ); + } std::string res( hostname ); return res; }