Page 1 of 1

Common #define for AmigaOS4 or AmigaOS in general

Posted: Thu Jan 17, 2013 10:23 pm
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

Re: Common #define for AmigaOS4 or AmigaOS in general

Posted: Fri Jan 18, 2013 1:24 am
by tonyw
All the SDK includes use "__amigaos4__"

That's two underscores on each side.

Re: Common #define for AmigaOS4 or AmigaOS in general

Posted: Fri Jan 18, 2013 2:08 pm
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

Re: Common #define for AmigaOS4 or AmigaOS in general

Posted: Sat Jan 19, 2013 7:13 pm
by Reth
Thanks guys!