etc.c.zlib help

Nicholas Wilson via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jul 2 05:36:34 PDT 2015


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

Is that a compiler error or a linker 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.

>char[] fName = "C:\\Users\\Matthew 
>Gamble\\Documents\\sample.bam\0".dup;
>bamFile = gzopen(&fName[0],&mode[0]);

would be probably be more easily understood if written as:
string fName  = "C:\\Users\\Matthew 
Gamble\\Documents\\sample.bam";
bamFile = gzopen(fName.ptr,mode.ptr);

as string _literals_ are nul terminated in D ( but not 
dynamically constructed ones: use .toStringz on them) assuming 
that gzopen doesn't manipulate it's arguments (I would very much 
doubt that).

Also if you're trying to do bam parsing/manipulating/whatever try 
to get a hold of Artem Tarasov who occasionally posts on these 
forums. He wrote the worlds fastest bam parser in D. He might be 
able to give you some hints on further questions.




More information about the Digitalmars-d-learn mailing list