Mail Archives: djgpp/1997/03/04/06:31:28
On Mon, 3 Mar 1997, Scott Fleischman wrote:
> I am wondering why this code works fine in the Win95 Dos box, yet doesn't
> work under Win95 msdos mode w/ cwsdpmi or in dos 6.22 w/ qemm unless I
> change the line:
> info.address = (long) addr + __djgpp_base_address;
> to
> info.address = (long) addr - __djgpp_base_address;
> (or "... + __djgpp_conventional_base" since they are equivalent.)
Why, because that's how you should use nearptrs! The correct way is
to add the `__djgpp_conventional_base', NOT `__djgpp_base_address' (it
is documented that way in the libc reference). You should never mess
with `__djgpp_base_address' anyway.
And btw, you should take the value of `__djgpp_conventional_base'
immediately after a call to `__djgpp_nearptr_enable'. Your code calls
`sbrk' between these two, which is unsafe (`sbrk' will sometimes move
the base address).
- Raw text -