Copyright (c) 2012-2016 Hyperion Entertainment and contributors.

SDK FAQ

From AmigaOS Documentation Wiki
Jump to: navigation, search

How do I get the Library base pointer provided an Interface pointer?

Every Exec Interface has a pointer back to the Library which owns it. There is no need to pass the Library pointer around or provide a global Library pointer. The Interface pointer contains all you need.

struct Library *base = IExec->OpenLibrary("intuition.library", 50);
struct IntuitionIFace *IIntuition = (struct IntuitionIFace*) IExec->GetInterface(base, "main", 1, NULL);
 
IDOS->Printf("Intuition Library pointer=%p\n", IIntuition->Data.LibBase);

How do I check for a minimum Library version and revision?

Use the LIB_IS_AT_LEAST() macro (defined in exec/libraries.h) to determine if a Library you opened is at the minimum version and revision required.

struct Library *libBase = IExec->OpenLibrary("exec.library", 50);
 
if ( LIB_IS_AT_LEAST(libBase, 53, 58) )
{
  IDOS->Printf("Found the correct version!\n");
}
else
{
  IDOS->Printf("Minimum version 53.58 required.\n");
}

What are all these new DOS errors I'm seeing?

If you experiencing issues with DOS constants it is likely your code has not been updated to the newer definitions. To access the obsolete definitions add the following to your source file:

#include <dos/obsolete.h>

Why am I now getting warnings related to Image/Gadget and Object pointers?

If you see warnings like the following:

Prefs.cpp:97: error: cannot convert 'Image*' to 'Object*' in argument passing

your code likely needs updating to use the proper BOOPSI types.

In BOOPSI, objects can be passed around as a pointer to type Object. When Intuition functions expect a specific type they will require it to be passed as a struct Gadget * or struct Image * in arguments. They are still BOOPSI objects but they need to be type casted. This safety mechanism is there to prevent programmers from accidentally passing incorrect BOOPSI object pointers.

What is version 2 of the Application Library interfaces?

Starting with SDK 53.24 the Application Library interfaces, application and prefsobjects, must be at version 2. That means you need to change your code to do the following:

struct ApplicationIFace  *IApplication  = (struct ApplicationIFace *)  IExec->GetInterface(appBase, "application", 2, NULL);
struct PrefsObjectsIFace *IPrefsObjects = (struct PrefsObjectsIFace *) IExec->GetInterface(appBase, "prefsobjects", 2, NULL);

The interface changes were necessary to fix API flaws. Interfaces are not backwards or forwards compatible so they must be specified precisely as well.