Re: Error 42: Symbol Undefined __lseeki64

2015-12-17 Thread Byron Heads via Digitalmars-d-learn

On Thursday, 17 December 2015 at 04:11:56 UTC, tcak wrote:
I searched the function "__lseek64" under /usr/include/dmd" 
with "grep -R __lseek64", but nothing is found. I work on Linux 
64-bit. So, I guess it is either Windows related, or 32bit dmd 
related. "lseek64" is found in "unistd.d", but this doesn't 
solve any problem.


After some testing it seems that
-m32mscoff and -m64 both build correctly so its related to 32bit 
dmd on windows






Re: Error 42: Symbol Undefined __lseeki64

2015-12-17 Thread Basile B. via Digitalmars-d-learn

On Thursday, 17 December 2015 at 04:11:56 UTC, tcak wrote:
On Wednesday, 16 December 2015 at 18:30:41 UTC, Byron Heads 
wrote:
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
I searched the function "__lseek64" under /usr/include/dmd" 
with "grep -R __lseek64", but nothing is found. I work on Linux 
64-bit. So, I guess it is either Windows related, or 32bit dmd 
related. "lseek64" is found in "unistd.d", but this doesn't 
solve any problem.


Of course it's windows related. 'lseek' is a posix function. 
There's a version/#define somewhere that's missing, maybe in the 
C binding, because under Windows lseek is 'SetFilePointer'.


But I'm not able to find it...
:/


Re: Error 42: Symbol Undefined __lseeki64

2015-12-16 Thread Byron Heads via Digitalmars-d-learn

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);
}






Error 42: Symbol Undefined __lseeki64

2015-12-16 Thread Byron Heads via Digitalmars-d-learn

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.


Re: Error 42: Symbol Undefined __lseeki64

2015-12-16 Thread Byron Heads via Digitalmars-d-learn

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() {

}





Re: Error 42: Symbol Undefined __lseeki64

2015-12-16 Thread Byron Heads via Digitalmars-d-learn

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..



Re: Error 42: Symbol Undefined __lseeki64

2015-12-16 Thread tcak via Digitalmars-d-learn

On Wednesday, 16 December 2015 at 18:30:41 UTC, Byron Heads wrote:
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:

[...]



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);
}


I searched the function "__lseek64" under /usr/include/dmd" with 
"grep -R __lseek64", but nothing is found. I work on Linux 
64-bit. So, I guess it is either Windows related, or 32bit dmd 
related. "lseek64" is found in "unistd.d", but this doesn't solve 
any problem.