What is the benefits of using Interfaces under AmigaOS 4.x

Answered
2
2

Let’s say there’s no 68k, only PPC, what is the point of using Interfaces to program under AmigaOS 4.x?

I don’t see any advantages, as I see it now it only brings incompatibilities with Aros, Morphos and AmigaOS 3.x

Kamelito

  • You must to post comments
Great Answer
1
1

Yes, unfortunately it does reduce source compatibility to a certain extent, though it can easily be supported in code by using some compiler directives. Depending on the exact workings of your project, it should be possible to write code where only the library opening and closing is different – the library calls are kept the same and so the main bulk of the code will be the same across all platforms. The __USE_INLINE__ pre-processor symbol at the start of your code and a couple of #ifdef statements at your library opening and closing functions should be enough to have the same code compile across all flavours. Obviously, OS4-specific library calls can’t be used if you want the same code to run on OS3 etc.

Advantages that are provided by using interfaces include:

  • Multiple interfaces from the same library, for example keeping old programs working with a new library API by defining a legacy interface and a new interface with changed functionality allows old and new programs to use the same library without any problems. This also allows 68k compatibility without having to limit functionality, and also allows work-around to be included for old software without having to worry about new software using the workaround code.
  • Classic OS3 code can be simply recompiled with __USE_INLINE__ which allows native versions of classic applications with little or no source code changes.
  • Child process or threads can use the same interface as the parent process without having to open a new interface or library. This allows Exec to tell the difference between a group of threads constituting one application, and separate tasks. It can also keep track of child/parent relationships between tasks.

I know you didn’t ask about 68k compatibility, but it’s an important feature of all the NG OSes, as is API compatibility. Interfaces provide a mechanism for allowing these features while modifying and expanding features for new software.

  • kamelito
    Morphos is not doing this and yet it’s able to run 68k as good or better than AmigaOS 4.x. I still don’t get it, IIRC it was a Fleecy Moss idea. What’s wrong with programming AmigaOS 4.x using __USE_INLINE__ and avoiding all those interfaces stuff? Kamelito
  • Daedalus
    There’s nothing wrong with using __USE_INLINE__, which allows you to code just as you would for OS3. It just doesn’t allow the use of any version of the interface other than the legacy one, which might include new versions of calls with additional features over the OS 3 version. Interfaces have nothing to do with running 68k compiled software, which obviously wasn’t written to use them. 68k calls use a jump table just as they do in OS3, therefore the availability of interfaces are of no consequence to any differences in compatibility between OS4 and MorphOS.
  • You must to post comments
0
1

Interfaces add the possibility of making object-oriented multiple-inheritance structures in a modular format in much the same way as OOP.library does in AROS, as used in its HIDD system of drivers.  The added flexibility comes at the expense of a little runtime speed, however.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.