HP aC++ Release Notes Version A.03.95 (5900-1789; September 2011)

HP aC++ Release Notes
New Features in Version A.03.33
Chapter 1 43
-Bhidden Command Line Option
This option hides of all the symbols used in the translation unit other than the ones prefixed with
__declspec(dllexport), __declspec(dllimport), or specified with pragma
HP_DEFINED_EXTERNAL.
-Bhidden_def Command Line Option
This option hides all the symbols defined in the translation unit other than the ones prefixed with
__declspec(dllexport) or specified with pragma HP_DEFINED_EXTERNAL.
Since all the functions marked as hidden (both defined and referenced in the translation unit) are expected to
be defined in the same load module, the compiler can optimize the calls to those functions by generating
direct calls. But this requires you to notify the compiler about the functions not defined in the same load
module and ask it to generate indirect calls to them through the PLT. This can be done using the with pragma
HP_DEFINED_EXTERNAL. You have the option of choosing either of the following:
1. Hide the symbols defined and optimize calls to functions not defined in the current translation unit
(other than the ones specified using pragma HP_DEFINED_EXTERNAL).
2. Hide the symbols defined, but not optimize calls to functions not defined in the current translation unit
In this case, you do not have to worry about HP_DEFINED_EXTERNAL.
NOTE
1. To be able to use these features, the following linker patches need to be installed:
PHSS_24303 (for HP-UX 11.00)
PHSS_24304 (for HP-UX 11.11)
2. main function is always exported.
3. Compiler generated vtables and typeids are always exported.
4. The compiler defines macro __HP_WINDLL whenever -Bhidden or -Bhidden_def
options are used. This macro can be used for conditional compilation. For example,
#ifdef __HP_WINDLL
#define DLLEXPORT __declspec(dllexport)
#define DLLIMPORT __declspec(dllimport)
#else
#define DLLEXPORT
#define DLLIMPORT
#endif