Page 1 of 1

Library seglist pointer type

Posted: Sat Apr 15, 2017 8:17 am
by trixie
Looking at various library and BOOPSI class sources, I keep seeing the library base seglist member declared as either APTR or BPTR. I also see that depending on that declaration, the respective libClose and libExpunge vectors return either APTR or BPTR. Which of the two pointer types is correct?

Re: Library seglist pointer type

Posted: Sat Apr 15, 2017 10:14 am
by thomasrapp
Does not matter as long as you return the same 32 bits as you received in your library init function.

On 68k it's surely a BPTR as returned by LoadSeg().

Re: Library seglist pointer type

Posted: Sat Apr 15, 2017 10:32 am
by trixie
@thomasrapp
On 68k it's surely a BPTR as returned by LoadSeg().
That's what I thought would be the case (and what I've been using for years myself). I was just surprised to see APTRs here and there in library sources, and also <exec/libraries.h> in the latest OS4 SDK has a structure in which the seglist is declared as an APTR. So I've been wondering whether this is an inconsistency or whether the type doesn't matter.

Re: Library seglist pointer type

Posted: Sun Apr 16, 2017 5:18 pm
by broadblues
@trixie

A seglist is a BPTR but it hardly matters if all you are going to do is store and return it at expunge time. uint32 would be sufficicent for that.

If you want to do anything else with it, then it should be considered an anonymous handle and only manipulated with dos functions such as GetSegListInfo() in which case the segment argument is a BPTR .

I suppose exec includes might refer to it as APTR to remove the dependency on dos related include files?

Re: Library seglist pointer type

Posted: Sun Apr 30, 2017 12:11 pm
by trixie
broadblues wrote:@trixie
I suppose exec includes might refer to it as APTR to remove the dependency on dos related include files?
Could be. Perhaps the Exec developers could shed some light on this?