migrating to 64 bit

Rikki Cattermole alphaglosined at gmail.com
Sat Dec 14 16:57:02 PST 2013


On Sunday, 15 December 2013 at 00:10:20 UTC, Stephen Jones wrote:
> I have just moved to Windows 8.1 64bit. I copied the dmd 
> compiler and environment I was using on the 32 bit XP and 
> hooked up the environmental variables to see what would happen. 
> When I come to compile and run one of the Derelict3 programs it 
> compiles and runs ok (mouse isn't doing what it should but 
> haven't looked into why yet). The SDL2 dlls, including the ttf 
> and image dlls are from the 32 bit environment and they seem to 
> be working (window, text and images at least) on the 64 bit os. 
> I am just trying to get my head around this.
>
> 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. If this last is 
> true there would be no need for something like the gcc -m32 
> flag as that would be handled by the linker chosen. If it is 
> not true then is there a dmd flag to demand that the exe be 32 
> bit compatible?
>
> Also, what is the deal with using dlls from a 32bit system on a 
> 64bit os; is this just backwards compatibility?
>
> Any help or helpful links appreciated.

Object files, dll's and executables file are built for a target. 
A target being Windows 32 bit x86 or Windows 64 bit x86 aka 
x86_64. Dmd at least to my belief shouldn't inject any special 
code dependent on the OS or platform. It will compile different 
to the target as all compilers should. (Excluding e.g. Java which 
compiles to an intermediate language).

If your own a 64bit machine I assume you will be wanting to also 
target 64bit? If so have you got the linker setup correctly? 
Because it requires Microsoft's linker provided in e.g. Visual 
c++. The free version should be fine.

Also Derelict3 is now obsolete. If you're a package you want is 
not yet converted into the new DerelictOrg[1] structure don't 
worry but if it has been you may want to convert over to it.

With regards to changing the target for e.g. dmd, currently it 
only supports changing to 64bit from 32bit. Not platform or 
architecture. Just utilising -m32 and -m64.

[1] https://github.com/DerelictOrg


More information about the Digitalmars-d-learn mailing list