Library seglist pointer type

This forum is for general developer support questions.

Library seglist pointer type

Postby trixie » Sat Apr 15, 2017 9:17 am

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?
Smoke me a kipper, I'll be back for breakfast!
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
User avatar
trixie
 
Posts: 357
Joined: Thu Jun 30, 2011 3:54 pm
Location: Czech Republic

Re: Library seglist pointer type

Postby thomasrapp » Sat Apr 15, 2017 11:14 am

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
thomasrapp
 
Posts: 241
Joined: Sun Jun 19, 2011 12:22 am

Re: Library seglist pointer type

Postby trixie » Sat Apr 15, 2017 11:32 am

@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.
Smoke me a kipper, I'll be back for breakfast!
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
User avatar
trixie
 
Posts: 357
Joined: Thu Jun 30, 2011 3:54 pm
Location: Czech Republic

Re: Library seglist pointer type

Postby broadblues » Sun Apr 16, 2017 6:18 pm

@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
broadblues
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 484
Joined: Sat Jun 18, 2011 3:40 am
Location: Portsmouth, UK

Re: Library seglist pointer type

Postby trixie » Sun Apr 30, 2017 1:11 pm

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?
Smoke me a kipper, I'll be back for breakfast!
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
User avatar
trixie
 
Posts: 357
Joined: Thu Jun 30, 2011 3:54 pm
Location: Czech Republic


Return to General Developer Support

Who is online

Users browsing this forum: No registered users and 2 guests