title: Separating Compilation and Linking - in D
body: <p>OK, I'm currently playing with D (for the first time), so supposedly I'll be having some ultra-basic question... And here I am... :-)</p>
  
  <p>When I compile-link with <code>dmd</code> it compiles fine :</p>
  
  <pre><code>dmd myMain.d myTestModule.d
  </code></pre>
  
  <p>When setting the <code>-v</code> (verbose) flag, I noticed the process is basically a compilation step (with <code>-c</code> flag) and linking (with <code>gcc</code>) as usual.</p>
  
  <p><strong>However</strong>, when I'm trying compiling the following way, I keep getting errors :</p>
  
  <pre><code>dmd -c MyMain.d myTestModule.d
  gcc MyMain.o -o MyMain -m64 -lphobos2 -lpthread -lm
  </code></pre>
  
  <hr>
  
  <pre><code>Undefined symbols for architecture x86_64:
    "_D8someFunc3strFmZAya", referenced from:
        __Dmain in MyMain.o
  ld: symbol(s) not found for architecture x86_64
  collect2: ld returned 1 exit status
  </code></pre>
  
  <p>What's going on? Any ideas?</p>