[R-pkg-devel] ucrt is not 64-bit clean
Just wanted to share something I just run into and fixed - when an R package is compiled for 64-bit Windows using "ucrt" C library, functions like ftell() and fseek() use 32-bit arguments for offsets, rather than 64-bit. What's worse the type "off_t" is 32-bit as well, which defeats the purpose of introducing off_t in the first place. The solution for me was to replace ftell()/fseek() with MS-specific _lseeki64(), _ftelli64() and _fseeki64(), and redefine off_t to be 64-bit "long long int". So typical MS - there is a C-library to compile against but without changes the code only works up to 2GB. It might be a good idea to have an R-shim to isolate ucrt() and provide 64-bit functions for R packages. What do you think? best Vladimir Dergachev