Search code examples
c++visual-studio-2013x86.net-assemblydumpbin

Cannot find decorated function name in dll


I created a dll project in Visual Studio 2013

enter image description here

After compiling, I run

dumpbin /symbols DLLTest.dll

via cmd.exe in the directory where the dll is located, but I only get the summary

enter image description here

I ran

 dumpbin /all DLLTest.dll 

(with the text output option) but I could not find the decorated function name in the output (I searched for int and getSomeNum that should be part of the decorated name in the output dump).

I also tried to find a way in VS2013 to enter /FAs into the compiler options, but I was unable to find the compiler options in the C/C++ property pages of the project.

I would appreciate any help to identify the decorated function names.

EDIT: Thanks for the pointer, Jester. I have modified the original code

enter image description here

However, after recompilation bumpbin is still not showing any decorated name (with the /symbols option).


Solution

  • Try dumpbin /exports DLLTest.dll. I've tried myself:

    > type dlltest.cpp
    #include <windows.h>
    
    BOOL WINAPI DllMain(HINSTANCE hInst, DWORD fdwReason, LPVOID lpvReserved)
    {
        switch (fdwReason)
        {
        case DLL_PROCESS_ATTACH:
        case DLL_PROCESS_DETACH:
        case DLL_THREAD_ATTACH:
        case DLL_THREAD_DETACH:
            break;
        }
        return TRUE;
    }
    
    __declspec(dllexport) int getSomeNum(int a);
    __declspec(dllexport) int getSomeNum2();
    
    __declspec(dllexport) int getSomeNum(int a)
    {
        return 2 * a;
    }
    
    __declspec(dllexport) int getSomeNum2()
    {
        return 5;
    }
    > cl /LD dlltest.cpp
    dlltest.cpp
    Microsoft (R) Incremental Linker Version 12.00.30501.0
    Copyright (C) Microsoft Corporation.  All rights reserved.
    
    /out:dlltest.dll 
    /dll 
    /implib:dlltest.lib 
    dlltest.obj 
       dlltest.lib 라이브러리 및 dlltest.exp 개체를 생성하고 있습니다.
    > dumpbin /exports dlltest.dll
    Microsoft (R) COFF/PE Dumper Version 12.00.30501.0
    Copyright (C) Microsoft Corporation.  All rights reserved.
    
    
    Dump of file dlltest.dll
    
    File Type: DLL
    
      Section contains the following exports for dlltest.dll
    
        00000000 characteristics
        53C91AAE time date stamp Fri Jul 18 22:01:34 2014
            0.00 version
               1 ordinal base
               2 number of functions
               2 number of names
    
        ordinal hint RVA      name
    
              1    0 00001030 ?getSomeNum2@@YAHXZ
              2    1 00001020 ?getSomeNum@@YAHH@Z
    
      Summary
    
            3000 .data
            5000 .rdata
            1000 .reloc
            B000 .text