Library seglist pointer type

This forum is for general developer support questions.
Post Reply
User avatar
trixie
Posts: 409
Joined: Thu Jun 30, 2011 2:54 pm
Location: Czech Republic

Library seglist pointer type

Post 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?
The Rear Window blog

AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon RX 560 / ESI Juli@ / AmigaOS 4.1 Final Edition
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
User avatar
thomasrapp
Posts: 310
Joined: Sat Jun 18, 2011 11:22 pm

Re: Library seglist pointer type

Post 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().
User avatar
trixie
Posts: 409
Joined: Thu Jun 30, 2011 2:54 pm
Location: Czech Republic

Re: Library seglist pointer type

Post 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.
The Rear Window blog

AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon RX 560 / ESI Juli@ / AmigaOS 4.1 Final Edition
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
User avatar
broadblues
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 600
Joined: Sat Jun 18, 2011 2:40 am
Location: Portsmouth, UK
Contact:

Re: Library seglist pointer type

Post 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?
User avatar
trixie
Posts: 409
Joined: Thu Jun 30, 2011 2:54 pm
Location: Czech Republic

Re: Library seglist pointer type

Post 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?
The Rear Window blog

AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon RX 560 / ESI Juli@ / AmigaOS 4.1 Final Edition
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
Post Reply