delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/03/04/06:31:28

Date: Tue, 4 Mar 1997 13:15:16 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Scott Fleischman <safleisc AT students DOT wisc DOT edu>
cc: djgpp AT delorie DOT com
Subject: Re: __djgpp_base_address
In-Reply-To: <199703031950.NAA59580@audumla.students.wisc.edu>
Message-ID: <Pine.SUN.3.91.970304131456.12059A-100000@is>
MIME-Version: 1.0

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019