<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - clang does not pass link libraries correcly to MSVC's link.exe"
   href="http://llvm.org/bugs/show_bug.cgi?id=20868">20868</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang does not pass link libraries correcly to MSVC's link.exe
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows XP
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Driver
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>felixhaedicke@web.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=13002" name="attach_13002" title="Hello world example to reproduces">attachment 13002</a> <a href="attachment.cgi?id=13002&action=edit" title="Hello world example to reproduces">[details]</a></span>
Hello world example to reproduces

I am using clang to compile windows programs using the MSVC libraries and
tools, and the traditional gcc style driver (not clang-cl).

The attached example code needs an external library ("oldnames.lib") to link.
So normally, I would call it like this (the syntax works fine when comping with
MingW instead of MSVC):

clang -target i686-pc-windows-msvc main.c -o main.exe -loldnames

Unfortunately, this produces the following error (sorry, the error is in
German):
LINK : warning LNK4044: Nicht erkannte Option /loldnames; wird ignoriert.
LINK : fatal error LNK1181: Eingabedatei "oldnames.obj" kann nicht geƶffnet
werden.
clang.exe: error: linker command failed with exit code 1181 (use -v to see
invocation)

It seems that "-loldnames" is passed directly to the MSVC linker. This happens
with every library, not just "oldnames".

As a workaround, the following call works:
clang -target i686-pc-windows-msvc main.c -o main.exe -Wl,oldnames.lib</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>