title: How to get unresolved externals in lib error?
body: <p>yes I actually want to get that error. I am using MSVC (the command prompt). I would like to have .lib that would require definition of external symbol that gets linked to it. I must understand something wrong about static linking, because to me my approach seems legit:</p>
  
  <p>I have a file that looks roughly like this:</p>
  
  <pre><code>extern INFO_BLOCK user_setup;
  
  int
  crtInit()
  {
      SetInfoBlock(&amp;user_setup);
      return 0;
  }
  </code></pre>
  
  <p>when I try to use the .obj of this file in compilation with the main module
  <code>cl main.c file.obj</code> it says unresolved externals. That is desired behaviour.
  Nevertheless, once I pack the file.obj with <code>lib file.obj</code> even using /include:user_data (which frankly I don't trust as being of any use in this case)</p>
  
  <p>using the .lib with <code>cl main.c /link file.lib</code> does not generate missing externals and that is the problem. I need the programmer to define that symbol. Does extern get stripped away once you put your .obj in .lib? Where am I wrong?</p>