Common #define for AmigaOS4 or AmigaOS in general

Have a question about our Software Developer Kit? Ask them here.
Post Reply
Reth
Beta Tester
Beta Tester
Posts: 47
Joined: Mon Jun 20, 2011 3:44 pm

Common #define for AmigaOS4 or AmigaOS in general

Post by Reth »

Hi everybody,

I already asked this in a german Amiga developer forum. According to the answers there no common #define seems to exists like for example for Windwos, Linux or even MacOS.
So I hereby wanted to ask what's the official #define to distinguish AOS4 from other AOS versions or derivates (AROS hast its own one)?

Many thanks in advance and

Best Regards

User avatar
tonyw
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 1433
Joined: Wed Mar 09, 2011 1:36 pm
Location: Sydney, Australia

Re: Common #define for AmigaOS4 or AmigaOS in general

Post by tonyw »

All the SDK includes use "__amigaos4__"

That's two underscores on each side.
cheers
tony

kas1e
Beta Tester
Beta Tester
Posts: 483
Joined: Sat Jun 18, 2011 7:56 am
Contact:

Re: Common #define for AmigaOS4 or AmigaOS in general

Post by kas1e »

@Reth
So I hereby wanted to ask what's the official #define to distinguish AOS4 from other AOS versions or derivates (AROS hast its own one)?
AmigaOS4 - __amigaos4__
Morphos - __MORPHOS__
AROS - __AROS__
AmigaOS3 - __amigaos__

Through, on aos4, __amigaos__ will also "eats" fine (because it is amigaos still), so you need to take care about that part when you want os3 code be os3 code. I.e:

Code: Select all

 #if defined(__amigaos__) && !defined(__amigaos4__)
Thats how i usually do when want code works on all amiga like oses:

Code: Select all

#if defined(__amigaos__) && !defined(__amigaos4__)  // OS3
...os3code...
#elif (__amigaos4__) // os4
..os4code..
#elif (__MORPHOS__) // mos 
..moscode..
#elif (__AROS__) // aros
..aroscode
#endif
You can of course combine it as you need, like to make some code the same for os4/aros, or for os4/mos. Just keep in mind that on os4 "__amigaos__" define also eats as on os3, so add one more !define

Reth
Beta Tester
Beta Tester
Posts: 47
Joined: Mon Jun 20, 2011 3:44 pm

Re: Common #define for AmigaOS4 or AmigaOS in general

Post by Reth »

Thanks guys!

Post Reply