title: The value of ESP was not properly saved across a function call
body: <p>I am working on a Visual studio project
  Project A (which generates a static lib on compilation)</p>
  
  <p>has a class</p>
  
  <pre><code>using namespace mynamespace;
  class projectAclass
  {
    virtual int  funct1()=0;  //Pure virtual function
    virtual int funct2()=0;  //Pure virtual function
    virtual int funct3()=0;  //Pure virtual function
  };
  </code></pre>
  
  <p>Project B(which generates a DLL on compilation)</p>
  
  <pre><code>#define projectBclass_DLL __declspec( dllexport )
  class projectBclass_DLL projectBclass: public mynamespace::projectAclass
  {
    //Definitions of the 3 pure virtual functions are here
    int funct1() 
    {
      //definition go here
    }
    //similarly for funct2 and funct3
  
    int funct4()
   { //Definition goes here    }
    int funct5()
   { //Definition goes here    }
    int funct6()
   { //Definition goes here    }
  };
  </code></pre>
  
  <p>Now from the main function created in some other project I have created an object of class <strong>projectAclass</strong> and trying to call function <strong>funct1</strong> but i don't know some other function is getting called that are defined in <strong>projectBclass</strong> (let say funct4) when i am trying to debug the solution and after returning from <strong>funct4</strong> I am getting this 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>Thanks in advance</p>