title: C++ GetProcAddress() can't find the method of a static class
body: <p>I need to dynamically load a dll in C++.</p>
  
  <p>I have followed this tutorial <a href="http://msdn.microsoft.com/en-us/library/ms235636.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms235636.aspx</a> to create the dll and everything worked fine.</p>
  
  <p>Then I followed this one <a href="http://msdn.microsoft.com/en-us/library/64tkc9y5.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/64tkc9y5.aspx</a> and I've adapted the console application as follow:</p>
  
  <pre><code>typedef DOUBLE(CALLBACK* DllFunc)(DOUBLE, DOUBLE);
  
  int _tmain(int argc, _TCHAR* argv[])
  {
      HINSTANCE hDLL;               // Handle to DLL
      DllFunc dllFunc1;
      DOUBLE p1 = 1.0, p2 = 2.0, r;
      hDLL = LoadLibrary(L"MathFuncsDLL");
      if (hDLL != NULL)
      {
          cout &lt;&lt;  "DLL loaded: " &lt;&lt; hDLL &lt;&lt; endl;
          dllFunc1 = (DllFunc)GetProcAddress(hDLL, "MyMathFuncs@MathFuncs@Multiply");
          if (!dllFunc1)
          {
              // handle the error
              FreeLibrary(hDLL);
              cout &lt;&lt; "Function not found!" &lt;&lt; endl;
              return -1;
          }
          else
          {
              // call the function
              r = dllFunc1(p1, p2);
              cout &lt;&lt; "The result is: " &lt;&lt; r &lt;&lt; endl;
          }               
      }
      else {
          cout &lt;&lt; "Dll not found" &lt;&lt; endl;
          return -1;
      }
      cout &lt;&lt; "Press any key to exit." &lt;&lt; endl;
      int i;
      cin &gt;&gt; i;
      return 0;
  }
  </code></pre>
  
  <p>The DLL is loaded correctly and it is not null. The problem is the GetProcAddress() function which always return 0.</p>
  
  <p>I've tried with every combination of Namespace, ClassName, Method name. I've tried to use the scope operator (::) instead of the @ in the function name.</p>
  
  <p>I've tried to define the entire namespace as 
       extern "C"
  but nothing changes. Every time i run or debug the console application, it cannot find the 'Multiply' function.</p>
  
  <p>I think I'm missing something...
  Where am I wrong?</p>
  
  <hr>
  
  <p><strong>EDIT</strong></p>
  
  <p>Dependency Walker exposed me the following Export Table:</p>
  
  <p><img src="https://i.stack.imgur.com/MRg0s.png" alt="DLL Export table"></p>
  
  <p>Now I wonder what the last part of the function name means...
  Why does the __declspec(dllexports) add those symbols? </p>