cURL / Mailing Lists / curl-library / Single Mail

curl-library

large file support on Mingw

From: Mark A. Roman <mroman_at_archivas.com>
Date: Thu, 21 Jun 2007 14:30:20 -0400

Hi,

I am trying to get large file (> 2GB) support for a simple app building
on Mingw. I note that when configuring to build libcurl (7.16.2), none
of the large file support triggers seem to trip, and a simple PUT of a
file via curl_easy_perform() results in an error from a wrapped four
byte data type. The same code works fine on Linux, where the 2.1 GB
file is transferred to the same server but the offset is clearly 64 bit

Investigating further, it seems that there are MINGW interfaces like
__fstat64() and and specific stat structures like struct_stati64 that
access 64 bit values. I was wondering if anyone on the list has a
direct experience and a configure invocation that gets > 32 bit offsets
into libcurl on MINGW and then available to the app without modifying
the existing interfaces. Some recent postings describe using the MSVC
version directly, but I was hoping to be able to do builds from
source. Also, my own code makes use of affected interfaces, e.g.
fstat()/_fstat64, etc. so I need to sort this out.

An edited down version of the sample source follows, but I am pretty
sure the problem is outside of the app per se.

  char curlebuf[CURL_ERROR_SIZE];
  FILE *filep = NULL;
  struct stat st;
  CURL *curl;
  CURLcode rc;
  uint64_t size;

  curl = curl_easy_init();
  [...]
  filep = fopen(localpath, r ? "wb" : "rb");
  stat(localpath, &st);

  size = st.st_size;

  curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, curlebuf);
  curl_easy_setopt(curl, CURLOPT_URL, url);
  curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1) ;
  curl_easy_setopt(curl, CURLOPT_UPLOAD, 1);
  curl_easy_setopt(curl, CURLOPT_READDATA, filep);
  curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, size);

  rc = curl_easy_perform(curl);

Any assitance or advice would be appreciated.

thanks & regards,
mark
Received on 2007-06-21