Symbol visibility
[Defines]


Detailed Description

Macros for controlling inter-module symbol visibility and linkage.

These macros have platform specific values. CP_EXPORT, CP_IMPORT and CP_HIDDEN can be reused by plug-in implementations for better portability. The complexity is mostly due to Windows DLL exports and imports.

Each module should usually define its own macro to declare API symbols with CP_EXPORT and CP_IMPORT as necessary. For example, a mobule could define a macro MY_API in the API header file as follows.

 #ifndef MY_API
 #  define MY_API CP_IMPORT
 #endif

By default the API symbols would then be marked for import which is correct when client modules are including the API header file. When compiling the module itself the option -DMY_API=CP_EXPORT would be passed to the compiler to override the API header file and to mark the API symbols for export. The overriding definition could also be included in module source files or in an internal header file before including the API header file.


Defines

#define CP_EXPORT
 Declares a symbol to be exported for inter-module usage.
#define CP_IMPORT
 Declares a symbol to be imported from another module.
#define CP_HIDDEN
 Declares a symbol hidden from other modules.


Define Documentation

#define CP_EXPORT

Declares a symbol to be exported for inter-module usage.

When compiling the module which defines the symbol this macro should be placed at the start of the symbol declaration to ensure that the symbol is exported to other modules. However, when compiling other modules the declaration of the symbol should start with CP_IMPORT. See the example of how to do this.

#define CP_IMPORT

Declares a symbol to be imported from another module.

When compiling a module which uses the symbol this macro should be placed at the start of the symbol declaration to ensure that the symbol is imported from the defining module. However, when compiling the defining module the declaration of the symbol should start with CP_EXPORT. See the example of how to do this.

#define CP_HIDDEN

Declares a symbol hidden from other modules.

This macro should be placed at the start of the symbol declaration to hide the symbol from other modules (if supported by the platform). This macro is not intended to be used with symbols declared as "static" which are already internal to the object file. Some platforms do not support hiding of symbols and therefore unique prefixes should be used for global symbols internal to the module even when they are declared using this macro.


Generated on Fri Apr 6 15:40:55 2007 for C-Pluff C API by doxygen 1.5.1