Casting to far proc ptr
Rahul Dhesi
dhesi%cirrusl at oliveb.ATC.olivetti.com
Sun Oct 7 13:55:13 AEST 1990
(Intel- and Turbo C-specific stuff follows.)
In <2734 at crdos1.crd.ge.COM> davidsen at 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 <dhesi%cirrusl at oliveb.ATC.olivetti.com>
UUCP: oliveb!cirrusl!dhesi
More information about the Comp.lang.c
mailing list