473,407 Members | 2,546 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Debug : File :i386\chkesp.c ERROR

9
Hi

Below is the snippet of the code

C/C++ Prototype
Expand|Select|Wrap|Line Numbers
  1. extern “C” short FAR PASCAL RP1210_ClientConnect
  2. (
  3.     HWND hwndClient,
  4.     short nDeviceID, 
  5.     char far* fpchProtocol,
  6.     long lTxBufferSize,
  7.     long lRcvBufferSize,
  8.     short nIsAppPacketizingIncomingMsgs  
  9. );
  10.  
when we are trying to call the above prototype function RP1210_ClientConnect. in VC++ as shown below to build a dll and when we are calling the DLL function we are facing a problem
---------------------------------------------------------------
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
  1. typedef short (*MYPROC_RP1210_ClientConnect)(HWND,short,char far*,long,long,short);
  2.  
  3. short VT_CA2ClientConnect(HWND hwndClient,short nDeviceID, 
  4.                                                 char *fpchProtocol,
  5.                                                 long lTxBufferSize,
  6.                                                 long lRcvBufferSize,
  7.                                                 short nIsAppPacketizingIncomingMsgs )
  8. {
  9.  
  10.     AFX_MANAGE_STATE(AfxGetStaticModuleState());  
  11.     HINSTANCE    hinstlib; 
  12.     BOOL    fRunTimeLinkSucess = FALSE; 
  13.     //BOOL fFreeResult;
  14.     MYPROC_RP1210_ClientConnect    ClientConnnectprocAdd ;
  15.  
  16.     short lError = 0;
  17.  
  18.     hinstlib = LoadLibrary("ca2rp32");
  19.     //if handle returns success
  20.     if( hinstlib != NULL){
  21.         //get the function address
  22.         ClientConnnectprocAdd = (MYPROC_RP1210_ClientConnect) GetProcAddress(hinstlib, "RP1210_ClientConnect");
  23.         //call the function
  24.         if(fRunTimeLinkSucess = (ClientConnnectprocAdd != NULL))
  25.             lError    = (ClientConnnectprocAdd)(hwndClient,nDeviceID,fpchProtocol,lTxBufferSize,lRcvBufferSize,nIsAppPacketizingIncomingMsgs);
  26.     }
  27.         //free all handles
  28.         //fFreeResult = FreeLibrary(hinstlib);
  29.     return lError;
  30.  
  31. }
-----------------------------------

Please can anyone help me to find the solution.
Sep 5 '07 #1
3 8289
weaknessforcats
9,208 Expert Mod 8TB
I expect your function name is being mangled.

Try a adding DEF file in your dll project to export your mangled name as an unmangled name. Here's an example:

Expand|Select|Wrap|Line Numbers
  1. ;BEGIN ADLL.DEF FILE
  2. ;This DEF file is required because the argument to GetProcAddress()
  3. ;for the function is a C-string and it will never be equal to the
  4. ;C++ mangled name for the function
  5. ;This DEF file maps the mangled name to a name that can be used with GetProcAddress()
  6. ;Note also: Change project settings in Visual Studio to send the LINK this def file.
  7. ;Visual Studio.NET: Project Properties/Linker/Input/Module Definition File/...Path to the def file\Adll.def
  8. LIBRARY ADll 
  9. EXPORTS 
  10. ;Exported Name    C++ Mangled Name
  11. AreaOfSquare   =  ?AreaOfSquare@@YGHHH@Z
  12. DisplayFromDll =  ?DisplayFromDll@@YGXXZ
  13. ;END DEF FILE 
  14.  
Sep 5 '07 #2
This i386/chkesp debug error occurs when there is stack overflow in the code . Use debug step by step mechanism to find out at what actual point , the error occurs. you can trap that array or string which causes stack overflow.
Also clean up watch and debug directory and try . Remove only .obj and .sbr files .. take backup before u clean.

But trap the wrong code and correct it.
Dec 17 '08 #3
weaknessforcats
9,208 Expert Mod 8TB
I just noticed that RP1210_ClientConnect is not a function. It's an extern "C" block.

The OP is not checking the return from GetProcAddress to see of it worked.
Dec 17 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Mike C. Fletcher | last post by:
Every few months I get to working on a Python C extension (built with distutils) and discover a pointer error or the like where I'd like to be able to step into my DLL and see where the extension...
4
by: Stephen Miller | last post by:
Hi, I am running v1.1.4322 on Win2K server and unable to debug a ASP.Net application running locally, using a full URL (ie www.mysite.com). When I hit F5, I get the following error message: ...
4
by: Angel | last post by:
I am trying to debug a simple asp.net project using Visual Studio.net(2002) and receive the following error: Error while tring to run project. Unable to start debugging on the web server....
10
by: Scott | last post by:
I have a simple asp.net app which works fine in debug mode, but crashes on the following line when I run it on the production server: Dim dt As DataTable I have tried the following variations...
1
by: joemynz | last post by:
Help please with a URLError. Invoking a url that works in Firefox and IE results in a "urlerror 7, no address ..." in python. I need to debug why. Traceback is below. There's a redirect when the...
8
by: Fred Flintstone | last post by:
I have an odd problem. I'm beating myself bloody trying to get debugging to work. I have VS.Net 2005 installed on a Windows XP SP2 workstation and on a W2003 Server. The asp.net application is...
4
by: nmrcarl | last post by:
I'm trying to upgrade a large project from VS 6.0 to VS 2005. After fixing a lot of things that changed (mostly sloppy coding in the original project that VS2005 didn't allow), I got the release...
6
by: Scubadude | last post by:
Hi, I'm new to perl and have run into some roadblocks while trying to run tutorials. I have installed Apache v2.2.3 I have installed ActivePerl v6.6.1.638 I have installed php v5.2.0 I am...
6
by: Andrew Rowley | last post by:
I am having trouble getting debug and release builds to work properly with project references using C++ .NET and Visual Studio 2003. I created a test solution, with a basic Windows form C++...
3
by: rorni | last post by:
Hi, I'm porting code from Windows to HP-UX 11, compiling with g++. I'm getting a compilation error on the system's debug.h include file, which is included very indirectly through a series of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.