Mail Archives: djgpp/1997/10/01/05:20:04
On Mon, 29 Sep 1997, Gustav Roder wrote:
> I'm writing a mouse-handler in DJGPP. I need to get the segment and
> offset of my handler-function.
>
> How can I estimate the segment and offset of a function in DJGPP?
You cannot ``estimate'' the segment and an offset of a DJGPP function,
because they live in protected-mode memory, almost always above the
1MB mark, and real-mode seg:off addresses cannot address more than
1MB.
In addition, you cannot pass the address of your handler directly to
the mouse driver, because your function will then be called in real
mode (the driver itself is a real-mode software), and it won't work at
all.
What you need is to allocate a real-mode callback that will switch
into protected mode befoe calling your function, and pass the address
of that callback to the mouse driver. The DJGPP FAQ list (available
as v2/faq210b.zip from the same place you get DJGPP) explains how to
do that in section 18.8; in fact, it actually uses the mouse handler
as example, so you even have some code there.
- Raw text -