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 45
__declspec(dllexport) mem();
goo();
};
5. In the following program, exporting symbols with internal linkage is illegal:
__declspec(dllexport) static int static_int; //illegal
int main()
{
__declspec(dllexport) int local_export; //illegal
return 0;
}
6. In the following program, importing defined symbols is illegal:
__declspec(dllimport) int func() { } //illegal
7. In the following program, selectively exporting a member function when the class itself is imported is
illegal:
class __declspec(dllimport) Employee
{
__declspec(dllexport) void mem(); // illegal
};
8. In the following example, there are 2 source files: dll.C and caller.C. dll.C is used to build the
shared library containing the definition for class BaseClass. In caller.C, class DerivedClass
derives from BaseClass. Virtual member function foo() is overridden by DerivedClass. But the
other virtual member function goo() is not. Since goo() is not exported from the shared library
(dll.sl), the linker gives an unresolved symbol error. You should be careful that all such functions are
exported from the shared library.
//dll.h
class BaseClass
{
public:
BaseClass() { }
virtual void foo();
virtual void goo(); // should be exported as it is needed
// in the derived class which does not
}; // override it
//end of dll.h
//dll.C
#include “dll.h”