Project

General

Profile

Bug #581

xdrfile library does not open large files (>2Gb) if used from C++

Added by Semen Yesylevskyy about 9 years ago. Updated about 9 years ago.

Status:
Closed
Priority:
Normal
Category:
mdrun
Target version:
Affected version - extra info:
Affected version:
Difficulty:
uncategorized
Close

Description

If xdrfile library is used from C++ project (by directly including xdrfile.h and linking statically) it can't handle large file (> 2Gb).

The problem is that the flag D_FILE_OFFSET_BITS=64 should be passed to compiler explicitly to enable large files in fopen call, but it is not needed for "normal" std file handling routines in C++ (thus not used). As a result the code refuses to work "mysteriously" for large files.

Solution:
Add
#define _FILE_OFFSET_BITS 64
to xdrfile.c

History

#1 Updated by David van der Spoel about 9 years ago

I have added this fix, and some more to comply with type checking and your 64 bit check. Are you sure it won't break stuff on other platforms?

Also available in: Atom PDF