Copyright (c) Hyperion Entertainment and contributors.

Difference between revisions of "SDK FAQ"

From AmigaOS Documentation Wiki
Jump to navigation Jump to search
Line 1: Line 1:
  +
= 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.
  +
  +
<syntaxhighlight>
  +
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");
  +
}
  +
</syntaxhighlight>
  +
 
= What are all these new DOS errors I'm seeing? =
 
= What are all these new DOS errors I'm seeing? =
   

Revision as of 15:44, 12 October 2013

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.