On 7/3/2015 8:44 AM, Matthew Gamble wrote:
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?

The Phobos source actually includes the C source for zlib. You can find it in the DMD distribution in src/phobos/etc/c/zlib/. When Phobos is compiled, it also compiles zlib and pulls the library into the final Phobos lib. You don't need the zlib DLL.

You have no error in 64-bit because it's working as expected. The trick now is to determine what's screwing things up in 32-bit. The starting point is at [1]. A quick bit of googling appears to suggest that _lseeki64 is a function specific to the Microsoft C runtime. I assume you're seeing the linker error because the DMC C runtime, which is the default used by DMD on Windows, does not include this function. If you compile using -m32mscoff (which also requires compiling a compatible version of Phobos), you'll be using the MS toolchain for 32-bit and the error should go away.

This is all assumption, but it's where I would start. And if this actually is the issue ([2] suggests it is), I'm surprised it hasn't turned up before now.

[1] https://github.com/D-Programming-Language/phobos/blob/master/etc/c/zlib/gzlib.c#L8
[2] http://www.digitalmars.com/d/archives/c++/windows/32-bits/440.html


Reply via email to