Why do OS function calls in OS4 begin with "I"?

Answered
0
0

Why do OS functions in the OS4 API begin with a capital “I” instead of the traditional way?

I.e.:

IIntuition->OpenWindowTagList() instead of just OpenWindowTagList()

or IExec->CloseLibrary instead of CloseLibrary() ?

  • TenLeftFingers
    I’ll comment rather than answer because I don’t know for sure in the case you cite, but in a lot of companies using Java it’s common to use ‘I’ to let the viewer of the code know that they are coding against an interface rather than a instance of the class itself. Then you can tell without much investigation that the usual polymorphic options are available to you. Edit: After re-reading your question, I’m more certain that this is the case. It’s not the function that has the ‘I’, it’s the object. The object in this case is created with an interface (I’m willing to bet).
  • idrougge
    How can you have objects and interfaces in straight C?
  • TenLeftFingers
    Yes, I was wrong about the objects. But right about the interfaces! Interfaces are discussed a little in a previous question here: http://askamiga.com/questions/question/what-is-the-benefits-of-using-interfaces-under-amigaos-4-x
  • You must to post comments
Great Answer
2
0

The I simply represents the interface to the library, something that didn’t exist under OS3 but is used for OS4-specific programming. The interface is basically a struct containing pointers to the actual functions, and so replaces the jump table used in OS3. Most libraries also include a 68k jump table which means that 68k software can use these libraries transparently, and the interface or interfaces provided by the library when opened under OS4 mean that different versions of calls can be provided within the same library without breaking legacy behaviour for example.

Some more information on library interfaces under OS4: http://blog.hyperion-entertainment.biz/?p=481

  • idrougge
    Couldn’t the library just have two jump tables?
  • Daedalus
    Yes, that’s another solution they could’ve gone with I guess. The OS4 one would need to be at a different offset of course, which would need to be obtained on opening the library. In that way it wouldn’t be that different from the interfaces solution, without the extra OS4-specific calling conventions, but also without the extra features that offers, such as interface versioning.
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.