Solved

longjmp in windows

Posted on 1997-10-14
4
235 Views
Last Modified: 2013-12-03
I have a question concerning longjmp in Windows.

I am using some old DOS code in a Windows 3.1 program and longjump doesn't seem to work the same.

I call setjmp from a C function to store the required information and everything works just fine.  When call LONGJMP(not the same in DOS) from an assembly function I get an exeption 13 error in the LONGJMP code.

I can't find any manual that will help me find the differences between the DOS longjmp and the Windows LONGJMP.
I know that they are different functions but what else should I need to do except call LONGJMP in place of longjmp?
Thanks.

AJ.
0
Comment
Question by:youngs101497
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 3

Expert Comment

by:mirek071497
ID: 1407548
In windows you are not  working in real mode so i think that this is your error. You can found some description about programming in protected and virtual mode at : www.intel.com. You can find there full set of instructions for pentium processors and description about them.

If you need more then ask, however i think so you must be familiar with other processor modes.
Good luck.
0
 
LVL 3

Accepted Solution

by:
Melange earned 100 total points
ID: 1407549
You should check out the Catch and Throw functions. These are 16-bit Win SDK functions that setjmp/longjmp map to.

Now things to consider are that you must NOT jump across message boundaries. In other words, in the same context of a windows message you must fully handle the catch/throw.

If you have visual C++, then check out mfc's afx.h header file. 16-bit MFC uses these functions for its simulated C++ exception handling.

0
 

Author Comment

by:youngs101497
ID: 1407550
I looked into using the Catch and Throw functions.  They will not work with the code I am using.  I don't want to have to rewrite large sections of code to do something that is suposed to work as well in Windows as it does in DOS.

All information I can find says that I can use setjmp and longjmp in a Windows program.

Do you know of any changes in the way which setjmp and long jmp are called?

This program has to work using setjmp and longjmp.  I wish I could use something else, it would just not be efficatious.


Thanks for your help.
0
 
LVL 3

Expert Comment

by:Melange
ID: 1407551
The most important thing to remember is NOT to jump across a windows message. You can't have one global setjmp for the program. Only use it within a specific context.

0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question