title: Why does the symbol of the SHA512 function in libeay32 not have a leading underscore?
body: <p>I am attempting to use OpenSSL's <code>SHA512</code> function in a C++ project of mine. In order to do this, I include <code>openssl/sha.h</code> in my source files that call <code>SHA512</code> and link with the <code>libeay32.lib</code> library.</p>
  
  <p><code>SHA512</code> is declared in <code>openssl/sha.h</code> as:</p>
  
  <pre><code>extern "C" {
  //...
  unsigned char *SHA512(const unsigned char *d, size_t n,unsigned char *md);
  //...
  }
  </code></pre>
  
  <p>When linking, however, the symbol is not found:</p>
  
  <pre>
  mysql_sha.obj : error LNK2019: unresolved external symbol _SHA512 referenced in function _sha512
  </pre>
  
  <p>The problem appears to be that in <code>libeay32.lib</code>, the symbol for the function is actually <code>SHA512</code> (no leading underscore), and I also see <code>__imp_SHA512</code> when normally it would be <code>__imp__SHA512</code>.</p>
  
  <p>I am using the <a href="http://www.slproweb.com/download/Win64OpenSSL-1_0_0d.exe" rel="nofollow">Win64 build of OpenSSL 1.0.0d</a> from Shining Light Productions.</p>
  
  <p>Why would the symbol of the <code>SHA512</code> function not have a leading underscore? How do I get around this problem?</p>