title: MASM: linking 2 asm files together failed: fatal error L1101: invalid object module?
body: <p>I was trying to compile 2 .asm files using a function call and link them together, the main program(m.asm) is :</p>
  
  <pre><code>assume cs: code
  
    extrn s: near
  
  code segment
  start:
    mov ax,20h
    call s
    mov ah,4ch
    int 21h
  code ends
  
    end start
  </code></pre>
  
  <p>And the function "s" is define in n.asm:</p>
  
  <pre><code>  assume cs: code
  
    public s
  
  code segment
  s:
    mov bx,4h
    div bx
    ret
  code ends
  
    end
  </code></pre>
  
  <p>So in dosbox I used masm to compile them:</p>
  
  <pre><code>masm m.asm
  masm n.asm
  </code></pre>
  
  <p>No problem, then I try to link them together:</p>
  
  <pre><code>link m.obj+n.obj m.exe
  </code></pre>
  
  <p>Now masm gives error:</p>
  
  <pre><code>M.EXE : fatal error L1011: invalid object module
   pos: 1 Record type: 4D
  </code></pre>
  
  <p>Why is that? Do I need any special compile/link flags to make it successful?
  Thanks.</p>