title: Calling convention Error!! (The value of ESP was not properly saved across a function call)
body: <p>I am new to creating  DLL libraries in c++ here is my code</p>
  
  <pre><code>//header.h
  class A
  {
    virtual int  funct()=0;  //Pure virtual function 
  };
  </code></pre>
  
  <p>Project B(which generates a DLL on compilation)</p>
  
  <pre><code>#include "header.h"
  #define B_DLL __declspec( dllexport )
  class B_DLL B: public A
  {
    //Definitions of the 3 pure virtual functions are here
    int funct() 
    {
      //definition go here
    }
  
  };
  </code></pre>
  
  <p>Now  I create an instance of class A and calling <strong>funct()</strong> then I am getting error</p>
  
  <pre><code>Run-Time Check Failure #0 - The value of ESP was not properly saved across a
  function call.  This is usually a result of calling a function declared with
  one calling convention with a function pointer declared with a different calling
  convention.
  </code></pre>
  
  <p>How this can be resolved using Calling conventions <strong>_cdecl</strong> or <strong>_stdcall</strong>.I searched this a lot But couldn't find exactly how this error can be resolved Please help me in resolving this</p>
  
  <p>Thanks in Advance</p>