Why Ruby?

David Nadlinger see at klickverbot.at
Sat Dec 11 11:10:38 PST 2010


On 12/11/10 2:46 PM, Michael Stover wrote:
> Having to use the dmc compiler on windows in order to leverage legacy
> C++ code while being able to move on with new D code doesn't sound like
> too much of a restriction.  Is there a similar tool that allows linking
> D and C++ on linux and mac?

You don't need any »similar tool« for statically linking C with D code 
on Linux or Mac – DMD produces standard ELF resp. Mach-O code there.

The problem you mentioned exists just on Windows, where DMD 
unfortunately generates object files/libraries in the fairly obscure 
OMF, whereas most other compilers use the PE/COFF format.

I understand that Walter had reasons when he picked OMF for DMD 
(experience, compatibility with his own C++ compiler), but in practice 
this can be a huge pain – you can't ignore that MSVC is what everyone 
uses on Windows, plus MinGW for some open source projects, both of which 
use COFF for their object files.

Since switching to DMC is not at all trivial in many cases (reasons 
include the build systems, not being able to use any precompiled 
packages, non-standard extensions, …), the issue is often worked around 
by building a DLL out of the C/C++ code, which is then loaded at runtime.


David


More information about the Digitalmars-d mailing list