Path: utzoo!utgpu!water!watmath!clyde!ima!johnl
From: johnl@ima.ima.isc.com (John R. Levine)
Newsgroups: comp.lang.c
Subject: Re: How to return from MS C function (as if from interupt)
Message-ID: <2702@ima.ima.isc.com>
Date: 24 Sep 88 18:10:22 GMT
References: <16166@shemp.CS.UCLA.EDU>
Reply-To: johnl@ima.UUCP (John R. Levine)
Organization: Not much
Lines: 26

In article <16166@shemp.CS.UCLA.EDU> todd@SEAS.UCLA.EDU (Todd Booth) writes:
>
>How can I [in MS C get the equivalent of the Turbo C ]
>"interrupt" function modifier.  For example:
>
>void interrupt myhandler()

In MS C 5.0 and newer, you write

void interrupt myhandler()

Isn't competition great?  Sadly, in both Turbo and MS C the interrupt
function uses the stack that already exists at the time of the interrupt
rather than using a private stack.  This makes these things practically
worthless for any real code since you can't assume that a random DOS stack
has room for more than a few words of saved state, so you have to write
little assembler stubs to wrap your C code.  MS C also has yet to add the
segment relative pointers such as "char * _ss stack_relative_pointer;" that
Turbo inherited from its Wizard C predecessor.  That makes it considerably
more difficult to write code that runs with SS != DS, even when you know it's
safe to do so.  Yeah, I know all Windows applications run that way and
they're all written in MS C, but they are certainly a pain to write and debug.
-- 
John R. Levine, IECC, PO Box 349, Cambridge MA 02238-0349, +1 617 492 3869
{ bbn | think | decvax | harvard | yale }!ima!johnl, Levine@YALE.something
Rome fell, Babylon fell, Scarsdale will have its turn.  -G. B. Shaw