title: Visual Studio 2008 release build not decorating DLL exports
body: <p>I'm building a C++ DLL in Visual Studio 2008 to be used by a C application written in Borland C++ Builder 6. </p>
  
  <p>My debug DLL build exports methods decorated with an underscore. However in my release DLL build the methods are not decorated causing linker errors in C++ Builder. (See below for output for dumpbin.exe for both build types)</p>
  
  <p>I've checked the compiler options for both debug and release configuration and cannot see anything that might be causing this problem.  </p>
  
  <p>I've managed it get around the problem. The Borland tool implib, which converts Visual Studio .lib files to a C++ Builder .lib files, can add an underscore. But I would like to understand why the exports are not being decorated.</p>
  
  <p><strong>Header file methods.h</strong></p>
  
  <pre><code>#ifndef METHODS_H
  #define METHODS_H
  
  #ifdef ENCRYPTION_EXPORTS
  #define DLLEXPORT __declspec(dllexport)
  #else
  #define DLLEXPORT __declspec(dllimport)
  #endif
  
  #ifdef __cplusplus
  extern "C"
  {
  #endif
  
  DLLEXPORT BOOL EncryptString(char *szPlain, char *szEncrypted);
  DLLEXPORT BOOL DecryptString(char *szEncrypted, char *szPlain);
  DLLEXPORT BOOL EncryptInitialise(void);
  DLLEXPORT void EncryptExit(void);
  
  #ifdef __cplusplus
  }
  #endif
  
  #endif
  </code></pre>
  
  <p><strong>Dumpbin.exe output for debug build</strong></p>
  
  <blockquote>
    <p>dumpbin /EXPORTS encryption.dll</p>
  </blockquote>
  
  <pre><code>Microsoft (R) COFF/PE Dumper Version 9.00.30729.01
  Copyright (C) Microsoft Corporation.  All rights reserved.
  
  Dump of file encryption.dll
  
  File Type: DLL
  
    Section contains the following exports for encryption.dll
  
      00000000 characteristics
      50B8B22E time date stamp Fri Nov 30 13:18:38 2012
          0.00 version
             1 ordinal base
             4 number of functions
             4 number of names
  
      ordinal hint RVA      name
  
            1    0 000308F7 DecryptString = @ILT+2290(_DecryptString)
            2    1 00031635 EncryptExit = @ILT+5680(_EncryptExit)
            3    2 000303CF EncryptInitialise = @ILT+970(_EncryptInitialise)
            4    3 0003003C EncryptString = @ILT+55(_EncryptString)
  
    Summary
  
          5000 .data
          1000 .idata
         13000 .rdata
          5000 .reloc
          1000 .rsrc
         64000 .text
         2F000 .textbss
  </code></pre>
  
  <p><strong>Dumpbin.exe output for release build</strong></p>
  
  <blockquote>
    <p>dumpbin /EXPORTS encryption.dll</p>
  </blockquote>
  
  <pre><code>Microsoft (R) COFF/PE Dumper Version 9.00.30729.01
  Copyright (C) Microsoft Corporation.  All rights reserved.
  
  Dump of file encryption.dll
  
  File Type: DLL
  
    Section contains the following exports for encryption.dll
  
      00000000 characteristics
      50B8BE14 time date stamp Fri Nov 30 14:09:24 2012
          0.00 version
             1 ordinal base
             4 number of functions
             4 number of names
  
      ordinal hint RVA      name
  
            1    0 00001A10 DecryptString
            2    1 000012C0 EncryptExit
            3    2 00001370 EncryptInitialise
            4    3 00001820 EncryptString
  
    Summary
  
          4000 .data
          4000 .rdata
          2000 .reloc
          1000 .rsrc
          F000 .text
  </code></pre>