#pragma ishome

C++ only


The #pragma ishome directive informs the compiler that the specified class's home module is the current compilation unit.  The home module is where items, such as the virtual function table, are stored. If an item is referenced from outside of the compilation unit, it will not be generated outside its home. This can reduce the amount of code generated for the application.


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


className Is the literal name of the class whose home will be the current compilation unit.


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