linking C library with D, creating a OpenVG D port

Rikki Cattermole via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Apr 3 05:09:47 PDT 2015


On 4/04/2015 1:00 a.m., ddos wrote:
> progress ... i think
> in some forum posts i've read 64bit dmd uses a differnt linker which
> supports coff
> atleast i can now link my app in 64bit mode without errors
> dmd -m64 source/app.d OpenVG.lib
>
> also an exported test function prints to stdout, so my problem is solved
> for x64 :)
>
> if anyone could explain how this could be done with 32bit builds i'd
> appreciate it
> why does dmd use different linkers for 32 and 64bit anyway?

In the beginning, Symantec had their own c/c++ compiler. That compiler 
was made by a humble but brilliant developer called Walter Bright. At 
the time the Microsoft toolchain was horribly incompatible between 
versions. In fact it was so bad, that a linker was made specifically for it.
At the time OMF was the standard binary format for Windows. Not long 
after PE-COFF was transitioned to for Windows 95.
Not long after this, Symantec dropped their toolchain and that clever 
developer negotiated the rights to it and in the process created a 
little company.

Furthering this, that clever developer didn't enjoy c++ not nearly as 
much as what others think of it. Instead choose to create a new language 
using the existing toolchain.

Fast forward about 12 years. The compiler still used that old linker but 
only for 32bit on Windows. But now the need was strong for 64bit 
support. After successful addition of 64bit support of *nix, Windows was 
worked on. Now nobody wanted to add 64bit support to that old old linker 
as it was written in an arcane dialect of assembly. Almost nobody 
understood it.

So the clever people, implemented it using the standard toolchain on the 
Windows platform. Instead of their own custom one. However it used 
PE-COFF for binary format. Unfortunately the need was not great to add 
it also for 32bit. Causing a great divide. That divide has since been 
resolved and will be forgotten about after one more major release.

Disclaimer: not 100% accurate, bunch of stuff I missed out. But more or 
less accurate timeline.


More information about the Digitalmars-d-learn mailing list