title: Precise library link order control with Microsoft Visual Studio 2010 IDE
body: <p>For a client I am attempting to recreate a command line based build tool in the Visual Studio 2010 IDE.  The compilation of the libs from projects including the C/C++ source files I have nailed, the link command line is giving me grief because the executable only links correctly if the libs are given in precisely the same order as the command line tool.  </p>
  
  <p>The command line is something like this:</p>
  
  <pre><code>link.exe -subsystem:console -machine:I386 -verbose:lib 
  -nodefaultlib:libc.lib -nodefaultlib:libcd.lib -nodefaultlib:libcmt.lib -nodefaultlib:libcmtd.lib 
  -DEBUG 
  -out:myout.exe 
  -pdb:myout.pdb 
  -libpath:../../path/to/libs
  libcmtd.lib kernel32.lib user32.lib ws2_32.lib netapi32.lib comctl32.lib gdi32.lib comdlg32.lib advapi32.lib winmm.lib imagehlp.lib shell32.lib  
  x_mylib.lib a_mylib.lib y_mylib3.lib z_my.lib  etc....
  </code></pre>
  
  <p>If the .libs the IDE compiles are linked with this command line then the .exe is correct, however I cannot get the IDE to link with precisely this .lib order - it insists on sorting all the libs alphabetically and linking.</p>
  
  <p>Any ideas anyone? 
  <em>avoiding the temptation to wander off into philosphical debates about the sense of this all, I can't change the command line based build tool</em></p>