digitalmars.D - dmd as link driver
- SK (11/11) Aug 12 2010 Hello D'ers,
- Walter Bright (6/17) Aug 13 2010 dmd does drive the linker. For example:
- SK (9/10) Aug 13 2010 Oops, sorry. I was thrown off the trail by the -L-l syntax for includin...
- Trass3r (3/3) Aug 13 2010 You can easily separate compilation and linking by using the -c option t...
Hello D'ers, Can dmd drive the linking process in two step compile-then-link builds? Lacking this capability complicates the CMake discovery process that uses small test compiles. In short, the problem is that CMake needs, but does not have, full knowledge of the C environment (to handle linking) before testing the D environment. I'm not a cmake expert, but I don't think I can express this dependency between two tool chains. A few experiments have failed to get this working. If the answer is that dmd cannot drive the linker, would a patch be easy enough to consider? -steve
Aug 12 2010
SK wrote:Can dmd drive the linking process in two step compile-then-link builds? Lacking this capability complicates the CMake discovery process that uses small test compiles. In short, the problem is that CMake needs, but does not have, full knowledge of the C environment (to handle linking) before testing the D environment. I'm not a cmake expert, but I don't think I can express this dependency between two tool chains. A few experiments have failed to get this working. If the answer is that dmd cannot drive the linker, would a patch be easy enough to consider?dmd does drive the linker. For example: dmd test will compile test.d and link it to form the test.exe executable. Similarly, dmd test.obj will just perform the link step.
Aug 13 2010
On Fri, Aug 13, 2010 at 1:02 AM, Walter Bright <newshound2 digitalmars.com>wrote:dmd does drive the linker. For example:Oops, sorry. I was thrown off the trail by the -L-l syntax for including a library. Gnu is my comfort zone and I went there without thinking. $ dmd -w -wi -c main.d $ dmd main.o -lphobos2 Error: unrecognized switch '-lphobos2' $ dmd main.o -L-lphobos2 (success)
Aug 13 2010
You can easily separate compilation and linking by using the -c option to just compile source files and then passing the object files to dmd to link it (or even invoke link yourself).
Aug 13 2010