#pragma hashome

C++ only


The #pragma hashome directive informs the compiler that the specified class has a home module that will be specified by #pragma ishome. This class's virtual function table, along with certain inline functions, will not be generated as static. Instead, they will be referenced as externals in the compilation unit of the class in which #pragma ishome was specified.


Read syntax diagramSkip visual syntax diagram>>-#--pragma--hashome--(--className--+------------+--)---------><


className specifies the name of a class that requires the above mentioned external referencing.  className must be a class and it must be defined.
AllInlines  specifies that all inline functions from within className should be referenced as being external. This argument is case insensitive.


A warning will be produced if there is a #pragma ishome without a matching #pragma hashome.


In the following example, compiling the code samples will generate virtual function tables and the definition of S::foo() only for compilation unit a.o, but not for b.o. This reduces the amount of code generated for the application.

// a.h
struct S
   virtual void foo() {}

   virtual void bar();

// a.C
#pragma ishome(S)
#pragma hashome (S)

#include "a.h"

int main()
   S s;

// b.C
#pragma hashome(S)
#include "a.h"

void S::bar() {}

Related information