NAME

docs/dev/parrot_api.pod - Notes on the PARROT_EXPORT macro

DESCRIPTION

This document addresses the correct use of the PARROT_EXPORT macro.

OVERVIEW

Some compilers and platforms export all symbols either by default or through a switch. Others have no such mechanism and either need a list of symbols to export or need the symbols annotating in the source.

The PARROT_EXPORT macro exists for the purpose of annotating symbols that should be exported. One day, it may be used to express which functions are in the Parrot extension API and which are not. For now it should be used to mark anything that will be used by a shared library or by the main Parrot executable when Parrot is built as a shared library.

USAGE

Incorrect usage of PARROT_EXPORT can break the build on some platforms, especially Win32. The rules for how to use it are as follows.

If you decorate a function with multiple modifiers, e.g., PARROT_EXPORT, PARROT_COLD, PARROT_CANNOT_RETURN_NULL, PARROT_EXPORT must appear first in the list.
If you decorate a function with PARROT_EXPORT in a .c file, you must also decorate the symbol with PARROT_EXPORT in all .h files that mention it.
If the symbol appears in more than one header file, all of them must have PARROT_EXPORT or none of them should. Some with and some without won't work.