Skip to content

Commit

Permalink
Windows compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
franzpoeschel committed Apr 27, 2021
1 parent 8627996 commit 0fca8b7
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/ChunkInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,14 @@
#include <iostream>
#include <list>
#include <map>
#include <unistd.h>
#include <utility>

#ifdef _WIN32
#include <windows.h>
#else
#include <unistd.h>
#endif

namespace openPMD
{
ChunkInfo::ChunkInfo( Offset offset_in, Extent extent_in )
Expand Down Expand Up @@ -569,7 +574,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;
}
Expand Down

0 comments on commit 0fca8b7

Please sign in to comment.