3.2 C runtime limitations

As Hollywood plugins on AmigaOS are loaded using LoadSeg() they do not contain the C compiler's runtime library startup code and there is no standardized way of executing the constructor and destructor functions of your C compiler's runtime library from a Hollywood plugin. This means that you won't be able to use any functions from the ANSI C runtime that require the compiler constructor or destructor code. Instead, you either have to call into AmigaOS API functions directly or you can use the C runtime functions that Hollywood makes available to your plugin in CRTBase that is passed to your InitPlugin() function.

Here is a list of functions that typically require the constructor and destructor code of your C compiler and therefore cannot be used from Hollywood plugins. Depending on your compiler, there may be more functions which cannot be used:

Memory allocation functions
Functions like malloc(), calloc(), realloc(), free(), strdup()...

File IO functions
All functions that deal with file handles like fopen(), fclose(), fread(), fwrite(), fgetc()...

Standard IO functions
Functions like printf(), sprintf(), scanf(), sscanf()...

Date and time functions
Functions like time(), localtime(), mktime(), gettimeofday()...

Locale dependent functions
Functions like toupper(), tolower(), isgraph()...

Please note that it is usually not possible to write Hollywood plugins in C++ on AmigaOS because C++ most of the time also needs custom compiler constructor and destructor code.

You also must not use any library auto-open features provided by the compiler. You need to manually open and close all Amiga libraries that your plugins requires.

Very experienced users might be able to work around all these limitations by finding a way to run the compiler's constructor and destructor code manually from the InitPlugin() and ClosePlugin() functions but this requires quite some effort and is different from compiler to compiler.


Show TOC