I get the following error when I run the 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."

Unable to understand what is causing this. Have given a snippet of the code that I think is relevant. Hope you can help me

Code:
[.cpp file]
void CClient2Dlg::OnReqMktData()
{
	m_pClient->reqMktData( m_dlgOrder->m_id, m_dlgOrder->getContract(),
		m_dlgOrder->m_genericTicks, m_dlgOrder->m_snapshotMktData);
	
	m_pClient->reqMktData2( m_dlgOrder->m_id, m_dlgOrder->getContract2(), 
		m_dlgOrder->m_genericTicks, m_dlgOrder->m_snapshotMktData);
}
[file end]

[.h file]
void EClientSocketBase::reqMktData(TickerId tickerId, const Contract& contract, const IBString& genericTicks, bool snapshot)
{
	std::ostringstream msg;
        
        (more code)

        bufferedSend( msg.str());
}

void EClientSocketBase::reqMktData(TickerId tickerId, const Contract2& contract2, const IBString& genericTicks, bool snapshot)
{
	std::ostringstream msg2;
        
        (more code)

        bufferedSend( msg2.str());
}
[file end]

[.cpp file]
#include "StdAfx.h"
#include "EClientSocket.h"

class EClientSocket::MySocket : public CAsyncSocket
{
public:
	MySocket( EClientSocket *pClient);
	void OnConnect( int i);
	void OnReceive( int i);
	void OnSend( int i);
	void OnClose( int i);
private:
	EClientSocket *m_pClient;
};
[file end]