DLL function names using dumpbin.exe

29,560

Solution 1

You need to pull those static member functions into the global address space and then wrap them with extern "C". This will suppress the C++ name mangling and instead give you C name mangling which is less ugly:

extern "C" __declspec(dllexport) Initialize(double a, double b)
{
    codec::Initialize(a, b);
}

and then remove the __declspec(dllexport) on your static member functions:

class codec
{
    public:
        static double Initialize(double a, double b);
}

Solution 2

This is called name-mangling and happens when you compile C++ with a C++-compiler. In order to retain the "humand-readable" names you'll have to use extern "C" when declaring and defining your classes and your functions. i.e.

extern "C" void myFunction(int, int); 

See here and also google mixing C and C++.

Share:
29,560
TomiL
Author by

TomiL

Updated on June 24, 2020

Comments

  • TomiL
    TomiL almost 4 years

    I have written a .dll library with lots of functions and classes in visual studio 2010. When I look at the content of the file with:

    dumpbin.exe /EXPORTS myDll.dll
    

    I get long function names with some kind of a function location pointer, which looks like this (second entry in .dll):

              2    1 0001100A ?Initialize@codec@codecX@@SANNN@Z = @ILT+5(?Initialize@codec@codecX@@SANNN@Z)
    

    This is somehow hard to read, but I saw "nicer" procedure/function list from other .dll-s, like this:

    141   8C 00002A08 PogoDbWriteValueProbeInfo
    

    How can I make that .dll list look that way?

    P.S.: my dll source code looks like this:

    namespace codecX
    {
       class codec
       {
          public:
          static __declspec(dllexport) double Initialize(double a, double b);
          ...
    
  • bash.d
    bash.d about 11 years
    @DavidHeffernan Let's agree I forgot about it, okay ;) ? But you are right, of course.