Below is the snippet of the code
C/C++ Prototype
Expand|Select|Wrap|Line Numbers
- extern “C” short FAR PASCAL RP1210_ClientConnect
- (
- HWND hwndClient,
- short nDeviceID,
- char far* fpchProtocol,
- long lTxBufferSize,
- long lRcvBufferSize,
- short nIsAppPacketizingIncomingMsgs
- );
---------------------------------------------------------------
Debug Error:
Module:
File:i386\chkesp.c
Line :42
The Value of ESP was not properly saved across a function call.............
--------------------------------------------------
DLL Code given below
Expand|Select|Wrap|Line Numbers
- typedef short (*MYPROC_RP1210_ClientConnect)(HWND,short,char far*,long,long,short);
- short VT_CA2ClientConnect(HWND hwndClient,short nDeviceID,
- char *fpchProtocol,
- long lTxBufferSize,
- long lRcvBufferSize,
- short nIsAppPacketizingIncomingMsgs )
- {
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
- HINSTANCE hinstlib;
- BOOL fRunTimeLinkSucess = FALSE;
- //BOOL fFreeResult;
- MYPROC_RP1210_ClientConnect ClientConnnectprocAdd ;
- short lError = 0;
- hinstlib = LoadLibrary("ca2rp32");
- //if handle returns success
- if( hinstlib != NULL){
- //get the function address
- ClientConnnectprocAdd = (MYPROC_RP1210_ClientConnect) GetProcAddress(hinstlib, "RP1210_ClientConnect");
- //call the function
- if(fRunTimeLinkSucess = (ClientConnnectprocAdd != NULL))
- lError = (ClientConnnectprocAdd)(hwndClient,nDeviceID,fpchProtocol,lTxBufferSize,lRcvBufferSize,nIsAppPacketizingIncomingMsgs);
- }
- //free all handles
- //fFreeResult = FreeLibrary(hinstlib);
- return lError;
- }
Please can anyone help me to find the solution.