Mail Archives: djgpp/2000/05/10/08:54:55
> From: LittleHelpNeeded <ummajera AT cc DOT umanitoba DOT ca>
> Newsgroups: comp.os.msdos.djgpp
> Date: Tue, 09 May 2000 11:59:31 -0700
>
> How do you change a __dpmi_paddr struct to a pointer like
> void* ???
>
> ie. If you have
>
> short selector;
> int offset;
>
> How do you make it to
>
> void *Pointer??
You cannot do that, unless the selector is identical to what _my_ds()
returns. A pointer such as "void *Pointer" is actually an offset
relative to the base address of the selector loaded into the DS
register. If you need to use an offset relative to another selector,
you need to use the farptr functions (_farpeekb, _farpokew, etc.).
Alternatively, you could enable nearptr method by calling
__djgpp_nearptr_enable, and adjust the offset accordingly. But I
don't recommend that, since it disables part of the memory protection.
If your selector is the same as _my_ds(), simply do this:
void *Pointer = (void *)offset;
- Raw text -