delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/18/12:11:00

Date: Sat, 18 Apr 1998 12:09:33 -0400 (EDT)
Message-Id: <199804181609.MAA23224@delorie.com>
From: DJ Delorie <dj AT delorie DOT com>
To: 9813152 AT fharga DOT sun DOT ac DOT za
CC: djgpp AT delorie DOT com
In-reply-to: <2057613D3B@fharga.sun.ac.za> (9813152@fharga.sun.ac.za)
Subject: Re: how do i get a pointer's selectors

> i would like to know how i can find out which segment a pointer 
> points to, after mallocing a chunk of memory.

It points to %ds, like every other pointer in djgpp, because djgpp is
always in tiny model.

> (question 2 : do pointers contain segments or are they just offsets) 

Pointers contain only offsets.

> (question  3 : if they are only offsets, which selector do i use with 
> them)

The convenience functions _my_ds(), _my_cs(), and _my_ss() can be used
to get the current selector values.  Or, you can use assembler to load
them yourself.  Unless you're interfacing with hardware or MS-DOS, you
shouldn't need to worry about selectors.  Most of the times that you
*are* interfacing with dos or bios, you probably could use
dosmmemput() or dosmemget() instead.

- Raw text -


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