Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

longjmp in windows

Posted on 1997-10-14
4
Medium Priority
?
241 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 200 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

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

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

This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
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…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

886 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