8.1.1. Setting symbol visibility

The visibility of a symbol or reference can be set in a number ways. It is normally set by the object producer, but most static linkers also provide a method to override the visibility of particular symbols.

An object producer normally has a default visibility setting for symbols, not to be confused with STV_DEFAULT here. For the ARM Compiler toolchain this is STV_HIDDEN. However, the object producer normally provides methods to override this either globally or for individual symbols. Globally overriding the visibility is normally done using a command-line option, for example --no_hide_all with armcc.

Overriding individual symbols is normally achieved using a source code annotation. Therefore users must individually mark the symbols they want to change the visibility of. There are number of different annotations used to do this. The two most common annotations are:

The ARM compiler (armcc) supports both of these annotations.



[4] While it is true that they use Microsoft syntax, they are used in a different way from the way they are used in Microsofts COFF toolchain. When building a COFF DLL, you make that DLLs header file conditional by using __declspec(dllexport) on all declarations instead of __declspec(dllimport). When building a Symbian DLL with the ARM Compiler toolchain, you normally mark the declarations in DLLs header file with the __declspec(dllimport) attribute and then override the attribute with __declspec(dllexport) for the definitions in the corresponding source file.

Copyright © 2010 ARM. All rights reserved.ARM DAI 0242A
Non-ConfidentialID011411