On Thursday, 2 July 2015 at 20:19:49 UTC, Laeeth Isharc wrote:
On Thursday, 2 July 2015 at 03:07:43 UTC, Matthew Gamble wrote:
I am trying to make the transition from C++ to D. I've hit a
snag with the etc.c.zlib module where any attempt to use this
module to open a file yields an error:
Error 42: Symbol Undefined __lseeki64.
Here is a simple example of code that gives the error upon
compilation.
import std.stdio;
import etc.c.zlib;
void main(string[] args)
{
char[] fName = "C:\\Users\\Matthew
Gamble\\Documents\\sample.bam\0".dup;
char[] mode ="r\0".dup;
gzFile bamFile; //no error here
bamFile = gzopen(&fName[0],&mode[0]); //this is where the
error hits
}
I'm using DMD32 D Compiler v2.067.1 on a windows 8 64 bit
machine. Working from either Visual D in Visual Studio 2013
Community and Coedit as IDEs gives the error. I'm probably
doing something obviously wrong, so have mercy. If etc.c.zlib
is not the preferred way to read from a binary gzipped file
any advice would be appreciated. Thanks.
Hi.
The etc.c.zlib headers are, I think, just translations of the C
headers and allow you to link with an external library. If the
library is not installed, or the compiler/linker cannot find
them then you may have a link error. Are you sure that Visual
Studio knows where to find the zlib library binary ? Can you
try compiling your project with DMD from the command line
appending -L-lz (that might work on linux, but I don't know on
windows)? There is a program called everything from void tools
that may be helpful in finding the library file if its location
is not obvious.
Laeeth
Thanks to Nicholas and Laeeth for all the suggestions. In the
process of trying to explicitly link to zlib.dll like a do for
C++, I came across a strange development. I changed the platform
to x64 (Visual D) and now the program compiles and runs fine
without errors. This is without pointing the linker to zlib.dll.
While this allows me to continue developing my program, I'm a bit
concerned about why this would fix the error and why etc.c.zlib
cannot be compiled for 32bit on a 64bit machine(Windows). Does
this give anyone any insights into this problem?
Best,
Matt