3.2 C runtime limitations

As Hollywood plugins on AmigaOS are loaded using LoadSeg() they do not execute the C compiler's runtime library constructor and destructor code automatically which means that many functions from the C runtime which depend on the C runtime constructor/destructor code won't work. In order to be able to use these functions, you must make sure your plugin executes the C runtime's constructor and destructor code manually. Alternatively, 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 without manually running the C runtime ctor/dtor code:

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()...

Depending on your compiler, there may be more functions which cannot be used without running the constructor/destructor code manually.

If you intend to write Hollywood plugins in C++ on AmigaOS you also need to manually call the constructor/destructor code because the C++ runtime most of the time also depends on custom compiler constructor and destructor code.

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


Show TOC