2.6 Compiling plugins

All source files that include hollywood/plugin.h need to be compiled with certain preprocessor commands defined, depending on the platform. Here is a list of preprocessor commands that may need to be defined, depending on your platform:

HW_AMIGAOS3
Needs to be defined for AmigaOS 3 builds.

HW_AMIGAOS4
Needs to be defined for AmigaOS 4 builds.

HW_ANDROID
Needs to be defined for Android builds.

HW_AROS
Needs to be defined for AROS builds.

HW_LINUX
Needs to be defined for Linux builds.

HW_LITTLE_ENDIAN
Needs to be defined for little endian builds.

HW_MACOS
Needs to be defined for macOS builds.

HW_MORPHOS
Needs to be defined for MorphOS builds.

HW_WARPOS
Needs to be defined for WarpOS builds.

HW_WIN32
Needs to be defined for Windows builds.

Also make sure to use the HW_EXPORT macro on all function declarations that you export as shared library functions to Hollywood, i.e.

 
HW_EXPORT int InitPlugin(hwPluginBase *self, hwPluginAPI *cl, STRPTR p)
{
    ...
}

Note that when targetting Hollywood 10.0 or better, your plugin function exports should always use the hwp_ prefix. Thus, if you target Hollywood 10.0 or better, you should export your InitPlugin() function like this instead:

 
HW_EXPORT int hwp_InitPlugin(hwPluginBase *s, hwPluginAPI *c, STRPTR p)
{
    ...
}

Using the hwp_ prefix makes sure that there are no clashes with other (system) APIs. Keep in mind, though, that if you use the hwp_ prefix in your function exports, your plugin won't run on any Hollywood version that is older than 10.0. That's why in this documentation the hwp_ prefix won't be explicitly mentioned in the documentation of the individual plugin functions because many plugin authors might want to target older Hollywood versions as well. If your plugin needs Hollywood 10.0 or better, though, you should always use the hwp_ prefix in your function exports and you should also define the HW_USEPREFIX macro so that the correct prototypes are used in hollywood/plugin.h.

Finally, don't forget to target your plugin for the right architecture. The 32-bit version of Hollywood can only load plugins compiled for a 32-bit architecture whereas the 64-bit version can only load plugins compiled for 64-bit. Modern compilers often default to 64-bit binaries nowadays so keep in mind that these binaries can't be loaded by the 32-bit versions of Hollywood. To make it easier for you to distinguish between 32-bit and 64-bit builds, the Hollywood SDK will automatically define the HW_64BIT preprocessor constant when it has detected that you are building for a 64-bit target.

On AmigaOS you also need to make sure that you do not link the compiler's startup code against the plugin as this can cause conflicts. You also must not use any library auto-open features provided by the compiler. You need to manually open all Amiga libraries that your plugin requires. See AmigaOS C runtime limitations for details.


Show TOC