Problem with Hiredis Binding

Puming zhaopuming at gmail.com
Thu Jan 5 21:34:46 PST 2012


> I think the problem still lies with your declaration of the 
> integer field. c_long in D is supposed to be equivalent to the 
> long type in C, *not* long long. It is declared as 32 bits on a 
> 32-bit system and 64 bits on a 64-bit system. I believe that in 
> practice, most C compilers implement long long as 64 bits on 
> both 32- and 64-bit systems. I recommend you use long on the D 
> side, rather than c_long. And, actually, it would be best to 
> compile a test with the same C compiler used to compile redis 
> to verify the size of long long.

I changed c_long to long and it actually works !!! Thanks very 
much. Now I'm wondering should I use `long` or do some static 
check for the type just like what c_long does for C' long type? 
I'm only using 32bit Ubuntu, so not able to check this on other 
systems. Wonder whether there is a c_long_long type.

In http://dlang.org/interfaceToC.html it says in 32bit system 
c_long is equivalent to `long long` in C. Is this wrong?


More information about the Digitalmars-d-learn mailing list