migrating to 64 bit

Marco Leise Marco.Leise at gmx.de
Sat Dec 14 17:35:41 PST 2013


Am Sun, 15 Dec 2013 01:10:18 +0100
schrieb "Stephen Jones" <siwenjo at gmail.com>:

> I would assume, and please tell me if I am wrong as that is the 
> point of the post, that any D code will compile on any dmd 
> compiler irrespective of whether 32 or 64 bit. But I would have 
> thought the object files compiled would be different, assuming 
> that the compiler knowing its environment stipulates in the 
> object files what the linker needs to do. Or am I wrong on this, 
> and that the object files will be identical but the linker sc.ini 
> defines will make the difference. […]

The object files are different, possibly even the way
arguments are passed to functions. But most importantly
pointer variables, "size_t" (used for array lengths etc.) and
CPU registers have a different size. For that and other
reasons you could not mix 32-bit and 64-bit code by loading a
64-bit DLL into a 32-bit program or linking together different
format object files.
I don't know if the linker needs to be told -m32 or -m64 or if
it is smart enough to figure it out from the object files, but
would otherwise generate an error about incompatible object
file formats.

> Also, what is the deal with using dlls from a 32bit system on a 
> 64bit os; is this just backwards compatibility?

Basically yes.

> Any help or helpful links appreciated.

-- 
Marco



More information about the Digitalmars-d-learn mailing list