Solved

longjmp in windows

Posted on 1997-10-14
4
231 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
  • 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
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…

786 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