Library seglist pointer type
Library seglist pointer type
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
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
- thomasrapp
- Posts: 310
- Joined: Sat Jun 18, 2011 11:22 pm
Re: Library seglist pointer type
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().
On 68k it's surely a BPTR as returned by LoadSeg().
Re: Library seglist pointer type
@thomasrapp
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.On 68k it's surely a BPTR as returned by LoadSeg().
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
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
- broadblues
- AmigaOS Core Developer
- Posts: 600
- Joined: Sat Jun 18, 2011 2:40 am
- Location: Portsmouth, UK
- Contact:
Re: Library seglist pointer type
@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?
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
Could be. Perhaps the Exec developers could shed some light on this?broadblues wrote:@trixie
I suppose exec includes might refer to it as APTR to remove the dependency on dos related include files?
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
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