#pragma ishome

C++ only

Description

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.

Syntax

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

where:

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

Notes

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

Example

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;
   s.foo();
   s.bar();
}



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

void S::bar() {}

Related information