Date: Tue, 4 Mar 1997 13:15:16 +0200 (IST) From: Eli Zaretskii To: Scott Fleischman cc: djgpp AT delorie DOT com Subject: Re: __djgpp_base_address In-Reply-To: <199703031950.NAA59580@audumla.students.wisc.edu> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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).