Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!julius.cs.uiuc.edu!apple!olivea!tymix!cirrusl!sunstorm!dhesi From: dhesi%cirrusl@oliveb.ATC.olivetti.com (Rahul Dhesi) Newsgroups: comp.lang.c Subject: Re: Casting to far proc ptr Message-ID: <2548@cirrusl.UUCP> Date: 7 Oct 90 03:55:13 GMT References: <2734@crdos1.crd.ge.COM> Sender: news@cirrusl.UUCP Organization: Cirrus Logic Inc. Lines: 23 (Intel- and Turbo C-specific stuff follows.) In <2734@crdos1.crd.ge.COM> davidsen@crdos1.crd.ge.COM (Wm E Davidsen Jr) writes: > I need to pass to address of a procedure to a called function. The >procedure is near static, and I need to cast to far, or assign the >address to a far ptr. Even if you can call the function, I think you will have problems, because it will have been compiled to do a near return. It will pop 16 bits off the stack and jump there. (Had Intel reversed the order in which segment and offset are pushed on the stack in a far call, it would have been possible to define a far function that could be called from both near and far.) Just finding the address of the function shouldn't be difficult, though. far_address = MK_FP(_CS, func); /* not tested */ -- Rahul Dhesi UUCP: oliveb!cirrusl!dhesi