DMD and C compatibility on Linux

Jonathan M Davis jmdavisProg at gmx.com
Sat Nov 27 14:11:26 PST 2010


On Saturday 27 November 2010 14:04:26 Bob Cowdery wrote:
> I've just started to get organised to port my project from Windows to
> Ubuntu. I see there is now a DMD for Linux which I have installed. My
> question is can anyone tell me what I need to build the C libraries in
> to be compatible. On Windows I had to use DMC or convert the libraries.
> As there is no DMC on Linux will GNU GCC output link with DMD output?

On windows, optlink is used by dmd to link binaries. optlink is the linker for 
dmc. Since, you need compatible linkers for both the D and C code if you want 
them to link together, you use dmc for your C code.

On Linux, gcc is used to link by dmd to link binaries. So, the C code needs to 
be linked by gcc. And since it pretty much already all is, you don't have to 
worry about it. The situtation is much better than on Windows where there you're 
more likely to be using Microsoft's compiler than dmc, and you have to adjust 
what your doing to use dmc. On Linux, it should just work (as long you're 
dealing with 32-bit libraries anyway; that can be a bit of a problem on 64-bit 
machines, since the 64-bit port for dmd isn't complete yet, but generally all 
you have to do is make sure that you have the 32-bit versions installed, and you 
should be fine).

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list