HIDE_TEMPLATE_DEFINITIONS
when you build your project, you must make modifications to the source files that define your class templates.
NOTE
Source file
modifications
This source file defines a class template TNotificationMemberFunctionOf<AReceiver>
:
NOTE // Copyright (C) 1995 Taligent, Inc. All rights reserved.
#ifndef Taligent_MEMBERFUNCTIONCONNECTION
#define Taligent_MEMBERFUNCTIONCONNECTION
#ifndef Taligent_PRIMITIVETYPES
#include "PrimitiveTypes.h"
#endif
#ifndef HIDE_TEMPLATE_DEFINITIONS
#define MAKE_TNotificationMemberFunctionOf_DEFINITIONS_VISIBLE
// ... more #defines for other template definitions in this file
#else
#define inline
#endif
#ifdef MAKE_TNotificationMemberFunctionOf_DEFINITIONS_VISIBLE
TemplateDefinitionsMacro(TNotificationMemberFunctionOf,AReceiver);
template <class AReceiver>
inline
TNotificationMemberFunctionOf<AReceiver>::TNotificationMemberFunctionOf(
MemberFunction theFunction) :
fFunction( theFunction )
{
}
// ... more definitions for this class
#endif
// ... more code
#ifdef HIDE_TEMPLATE_DEFINITIONS
#undef inline
#endif
HIDE_TEMPLATE_DEFINITIONS
disables the use of inline
in class template definitions in order, to work around a compiler idiosyncracy that prevents other libraries from accessing functions defined as inline
. Managing class
template
dependencies
If you develop several shared libraries, and one library defines a class template that the other libraries use to instantiate template classes, you should instantiate your template classes according to these guidelines:
For example, suppose you have developed shared libraries LibA
, LibB
, and LibC
, and that LibA
defines the class template ATemplate<Type>
. If both LibB
and LibC
use instantiations of ATemplate<Type>
, you should place these instantiations in the instantiations file for LibA
(see "Generating template class instantiations" on page 70). If only LibB
uses instantiations of ATemplate<Type>
, however, you should place the instantiations in the instantiations file for LibB
.
As the dependencies between your libraries evolve, you might want to move certain template class instantiations from one library to another.
[Contents]
[Previous]
[Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.