www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - dmd as link driver

reply SK <sk metrokings.com> writes:
--0016364d29bfe95d99048dae732d
Content-Type: text/plain; charset=ISO-8859-1

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

--0016364d29bfe95d99048dae732d
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<font face=3D"courier new,monospace">Hello D&#39;ers,<br><br>Can dmd drive =
the linking process in two step compile-then-link builds?<br><br></font><fo=
nt face=3D"courier new,monospace">Lacking this capability complicates the C=
Make discovery process that uses small test compiles.=A0 In short, the prob=
lem is that CMake needs, but does not have, full knowledge of the C environ=
ment (to handle linking) before testing the D environment.=A0 I&#39;m not a=
 cmake expert, but I don&#39;t think I can express this dependency between =
two tool chains.=A0 A few experiments have failed to get this working.<br>

<br>If the answer is that dmd cannot drive the linker, would a patch be eas=
y enough to consider?<br><br>-steve<br><br></font>

--0016364d29bfe95d99048dae732d--
Aug 12 2010
next sibling parent Walter Bright <newshound2 digitalmars.com> writes:
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
prev sibling next sibling parent Trass3r <un known.com> writes:
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
prev sibling parent SK <sk metrokings.com> writes:
--0016364ed7a8f79b22048db5de75
Content-Type: text/plain; charset=ISO-8859-1

On Fri, Aug 13, 2010 at 1:02 AM, Walter Bright
<newshound2 digitalmars.com>wrote:

 dmd does drive the linker. For example:

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) --0016364ed7a8f79b22048db5de75 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Fri, Aug 13, 2010 at 1:02 AM, Walter Bright <span dir=3D"ltr">&lt;<a hre= f=3D"mailto:newshound2 digitalmars.com" target=3D"_blank">newshound2 digita= lmars.com</a>&gt;</span> wrote:<br><div class=3D"gmail_quote"><blockquote c= lass=3D"gmail_quote" style=3D"margin: 0pt 0pt 0pt 0.8ex; border-left: 1px s= olid rgb(204, 204, 204); padding-left: 1ex;"> <div><div></div><div><br></div></div> dmd does drive the linker. For example:<br> <br></blockquote></div><br>Oops, sorry.=A0 I was thrown off the trail by th= e -L-l syntax for including a library.=A0 Gnu is my comfort zone and I went= there without thinking.<br><br>$ dmd -w -wi -c main.d<br>$ dmd main.o -lph= obos2<br> Error: unrecognized switch &#39;-lphobos2&#39;<br>$ dmd main.o -L-lphobos2<= br>(success)<br><br><br> --0016364ed7a8f79b22048db5de75--
Aug 13 2010