Common #define for AmigaOS4 or AmigaOS in general

Have a question about our Software Developer Kit? Ask them here.

Common #define for AmigaOS4 or AmigaOS in general

Postby Reth » Thu Jan 17, 2013 11:23 pm

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
Reth
Beta Tester
Beta Tester
 
Posts: 39
Joined: Mon Jun 20, 2011 4:44 pm

Re: Common #define for AmigaOS4 or AmigaOS in general

Postby tonyw » Fri Jan 18, 2013 2:24 am

All the SDK includes use "__amigaos4__"

That's two underscores on each side.
cheers
tony
User avatar
tonyw
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 1385
Joined: Wed Mar 09, 2011 2:36 pm
Location: Sydney, Australia

Re: Common #define for AmigaOS4 or AmigaOS in general

Postby kas1e » Fri Jan 18, 2013 3:08 pm

@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
kas1e
Beta Tester
Beta Tester
 
Posts: 481
Joined: Sat Jun 18, 2011 8:56 am

Re: Common #define for AmigaOS4 or AmigaOS in general

Postby Reth » Sat Jan 19, 2013 8:13 pm

Thanks guys!
Reth
Beta Tester
Beta Tester
 
Posts: 39
Joined: Mon Jun 20, 2011 4:44 pm


Return to SDK Support

Who is online

Users browsing this forum: No registered users and 1 guest