Using standard C libraries in modules

Standard C libraries, i.e. functions declared in standard headers such as stdio.h and stdlib.h, can be used in Alore C libraries. There are, however, some additional issues that need to addressed and that require some additional effort from the programmer in order to avoid problems in Alore C modules.

Most of these issues have already been discussed in this document. This section contains an overview of these issues and links to additional information if it can be found somewhere else in this document.

Freeing resources allocated by standard C library functions

The Alore garbage collector cannot see or automatically free memory and resources allocated using basic C functions such as malloc or fopen. The following issues are related to this:

Using file operations

Basic C file operations such as printf, fopen and read can be used in Alore C libraries, but the following issues should be addressed:

Performing blocking or long-running operations

Long-running or blocking C calls, for example file input/output, need to be surrounded with AAllowBlocking and AEndBlocking macros.