On Wednesday, 16 December 2015 at 18:21:33 UTC, Byron Heads wrote:
On Wednesday, 16 December 2015 at 18:14:35 UTC, Byron Heads wrote:
On Wednesday, 16 December 2015 at 17:23:15 UTC, Byron Heads wrote:
Seeing this issue on 2.069.2 using etc.c.zlib.

C:\d\dmd2\windows\bin\..\lib\phobos.lib(gzlib)
 Error 42: Symbol Undefined __lseeki64

The code was compiling in 2.067. Not clear on where to look to fix this issue.

I can reproduce with this code...
Windows dmd 2.069.2 32bit


import std.stream;
import std.exception;

// todo: add bzip support..
class GZipBufferedFile : BufferedFile {

private:
    GZipFile gZipFile;
    /**
* GZipFile stream, safly opens and closes a gzip file, also will correctly read from the zip file
     */
    class GZipFile : File {
      import std.c.stdio;
      import etc.c.zlib;

      FILE* fp;
      gzFile fpGZip;

      /**
       * Use gzopen to open the zip file
       */
      this(string filename) {
        fp = fopen(filename.toStringz, "rb");
enforce(fp !is null, "Failed to open file '%s'".format(filename));

        version(Windows) {
          fpGZip = gzdopen(fp._file, "rb");
          super(fpGZip, FileMode.In);
        } else {
          fpGZip = gzdopen(fileno(fp), "rb");
          super(cast(int)fpGZip, FileMode.In);
        }
        seekable = true;

        // Still not supported... sigh
        //gzbuffer(fpGZip, 1024 * 1024);
      }


      ulong tell() {
        fflush(fp);
        return ftell(fp);
      }

      /**
       * read data block with gzread
       */
      override size_t readBlock(void* buffer, size_t size) {
          assertReadable();

          size = gzread(fpGZip, buffer, cast(uint)size);
          if (size == -1) {
              size = 0;
          }

          // use gzeof to test for end of file
          readEOF = fpGZip.gzeof != 0;
          return size;
      }

      /**
       * make sure we close with gzclose
       */
      override void close() {
        gzclose(fpGZip);
        fpGZip = null;
        fp = null;
      }
  }

public:
  this(string filename) {
    gZipFile = new GZipFile(filename);
    super(gZipFile);
  }

  ulong tell() {
    return gZipFile.tell;
  }
}


void main() {

}


Commenting out

gzclose(fpGZip);

allows it to compile..

Submitted reduced case as a bug:
https://issues.dlang.org/show_bug.cgi?id=15457


import etc.c.zlib;

void main() {
  gzclose(null);
}




Reply via email to