Changeset 3831 in Sophya


Ignore:
Timestamp:
Aug 5, 2010, 2:16:20 PM (15 years ago)
Author:
ansari
Message:

Introduction et gestion du flag preprocesseur NEED_EXT_DECL_TEMP pour declaration extern des classes template avec instantiation explicite (pb dynamic_cast sur Mac OS 10.6), Reza 05/08/2010

Location:
trunk/SophyaLib
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/BaseTools/machdefs_mkmf.h

    r3750 r3831  
    145145/*   DECL_TEMP_SPEC        : Template specialization declaration           */
    146146/*   TSNMLUPG4             : Two stage name look-up scheme (g++>3.4)       */
     147/*   NEED_EXT_DECL_TEMP    : extern declaration for template classes       */
    147148
    148149
     
    175176#undef TSNMLUPG4
    176177#endif
     178
     179
     180/*  Dynamic_cast problem encountered on Mac OS X 10.6 for explicitly instanciated classes across
     181    dynamic libraries. solved by extern declaration of  explicitly instanciated template classes */
     182#ifndef NEED_EXT_DECL_TEMP
     183#define NEED_EXT_DECL_TEMP
     184#endif
     185
    177186
    178187/* now the specific things */
     
    208217#define __CXX_PRAGMA_TEMPLATES__
    209218#define PRAGMA_TEMPLATES
     219#undef NEED_EXT_DECL_TEMP   /* old compiler version cxx 6.5 - we don't activate extern declaration */
    210220#endif
    211221
  • trunk/SophyaLib/BaseTools/ndatablock.cc

    r3750 r3831  
    1010#include <complex>
    1111#include "pexceptions.h"
     12
     13#define NDATABLOCK_CC_BFILE  // avoid extern template declarations
    1214#include "ndatablock.h"
     15
    1316#include "thsafeop.h"  //  for ThreadSafe operations (Ref.Count/Share)
    1417
  • trunk/SophyaLib/BaseTools/ndatablock.h

    r3385 r3831  
    99#include <stdlib.h>        /* pour que size_t soit defini */
    1010#include "anydataobj.h"
     11#include <complex>
    1112#include <iostream>
    1213
     
    236237                      {return a.Div(b);}
    237238
     239//--------- extern template declarations (if needed) -----------
     240#if defined ( NEED_EXT_DECL_TEMP ) && !defined( NDATABLOCK_CC_BFILE )
     241extern template class NDataBlock<uint_1>;
     242extern template class NDataBlock<uint_2>;
     243extern template class NDataBlock<int_1>;
     244extern template class NDataBlock<int_2>;
     245extern template class NDataBlock<int_4>;
     246extern template class NDataBlock<int_8>;
     247extern template class NDataBlock<uint_4>;
     248extern template class NDataBlock<uint_8>;
     249extern template class NDataBlock<r_4>;
     250extern template class NDataBlock<r_8>;
     251extern template class NDataBlock< complex<r_4> >;
     252extern template class NDataBlock< complex<r_8> >;
     253#ifdef SO_LDBLE128
     254extern template class NDataBlock<r_16>;
     255extern template class NDataBlock< complex<r_16> >;
     256#endif
     257
     258#endif  // Fin de if defined ( NEED_EXT_DECL_TEMP )
     259
    238260} // Fin du namespace
    239261
  • trunk/SophyaLib/TArray/spesqmtx.cc

    r3824 r3831  
    44//  (C) R. Ansari, C.Magneville    2009 
    55
     6#define SPESQMTX_CC_BFILE  // avoid extern template declarations
    67#include "spesqmtx.h"
    78#include "pexceptions.h"
  • trunk/SophyaLib/TArray/spesqmtx.h

    r3809 r3831  
    263263  { SpecialSquareMatrix<T> result; result.CloneOrShare(a);
    264264    result.SetTemp(true);  result.DivElt(b); return result; }
     265
     266//--------- extern template declarations (if needed) -----------
     267#if defined ( NEED_EXT_DECL_TEMP ) && !defined( SPESQMTX_CC_BFILE )
     268extern template class SpecialSquareMatrix<uint_1>;
     269extern template class SpecialSquareMatrix<uint_2>;
     270extern template class SpecialSquareMatrix<uint_4>;
     271extern template class SpecialSquareMatrix<uint_8>;
     272extern template class SpecialSquareMatrix<int_1>;
     273extern template class SpecialSquareMatrix<int_2>;
     274extern template class SpecialSquareMatrix<int_4>;
     275extern template class SpecialSquareMatrix<int_8>;
     276extern template class SpecialSquareMatrix<r_4>;
     277extern template class SpecialSquareMatrix<r_8>;
     278extern template class SpecialSquareMatrix< complex<r_4> >;
     279extern template class SpecialSquareMatrix< complex<r_8> >;
     280#ifdef SO_LDBLE128
     281extern template class SpecialSquareMatrix<r_16>;
     282extern template class SpecialSquareMatrix< complex<r_16> >;
     283#endif
     284#endif  // Fin de if defined ( NEED_EXT_DECL_TEMP )
    265285 
    266286}   // namespace SOPHYA
  • trunk/SophyaLib/TArray/tarray.cc

    r3751 r3831  
    1010
    1111#include "pexceptions.h"
     12
     13#define TARRAY_CC_BFILE  // avoid extern template declarations
    1214#include "tarray.h"
    1315
  • trunk/SophyaLib/TArray/tarray.h

    r3386 r3831  
    481481typedef TArray<r_8> Array;
    482482
     483//--------- extern template declarations (if needed) -----------
     484#if defined ( NEED_EXT_DECL_TEMP ) && !defined( TARRAY_CC_BFILE )
     485extern template class TArray<uint_1>;
     486extern template class TArray<uint_2>;
     487extern template class TArray<uint_4>;
     488extern template class TArray<uint_8>;
     489extern template class TArray<int_1>;
     490extern template class TArray<int_2>; 
     491extern template class TArray<int_4>;
     492extern template class TArray<int_8>;
     493extern template class TArray<r_4>;
     494extern template class TArray<r_8>;
     495extern template class TArray< complex<r_4> >;
     496extern template class TArray< complex<r_8> >;
     497#ifdef SO_LDBLE128
     498extern template class TArray<r_16>;
     499extern template class TArray< complex<r_16> >;
     500#endif
     501#endif  // Fin de if defined ( NEED_EXT_DECL_TEMP )
     502
    483503} // Fin du namespace
    484504
  • trunk/SophyaLib/TArray/tmatrix.cc

    r3751 r3831  
    1 // $Id: tmatrix.cc,v 1.39 2010-03-03 20:46:07 ansari Exp $
     1// $Id: tmatrix.cc,v 1.40 2010-08-05 12:16:19 ansari Exp $
    22//                         C.Magneville          04/99
    33#include "sopnamsp.h"
     
    88#include <stdlib.h>
    99#include "pexceptions.h"
     10
     11#define TMATRIX_CC_BFILE  // avoid extern template declarations
    1012#include "tmatrix.h"
    1113
  • trunk/SophyaLib/TArray/tmatrix.h

    r2884 r3831  
    242242typedef TMatrix<r_8> Matrix;
    243243
     244//--------- extern template declarations (if needed) -----------
     245#if defined ( NEED_EXT_DECL_TEMP ) && !defined( TMATRIX_CC_BFILE )
     246extern template class TMatrix<uint_1>;
     247extern template class TMatrix<uint_2>;
     248extern template class TMatrix<uint_4>;
     249extern template class TMatrix<uint_8>;
     250extern template class TMatrix<int_1>;
     251extern template class TMatrix<int_2>;
     252extern template class TMatrix<int_4>;
     253extern template class TMatrix<int_8>;
     254extern template class TMatrix<r_4>;
     255extern template class TMatrix<r_8>;
     256extern template class TMatrix< complex<r_4> >;
     257extern template class TMatrix< complex<r_8> >;
     258#ifdef SO_LDBLE128
     259extern template class TMatrix<r_16>;
     260extern template class TMatrix< complex<r_16> >;
     261#endif
     262#endif  // Fin de if defined ( NEED_EXT_DECL_TEMP )
     263
     264
    244265} // Fin du namespace
    245266
  • trunk/SophyaLib/TArray/tvector.cc

    r3751 r3831  
    1 // $Id: tvector.cc,v 1.24 2010-03-03 20:46:07 ansari Exp $
     1// $Id: tvector.cc,v 1.25 2010-08-05 12:16:20 ansari Exp $
    22//                         C.Magneville          04/99
    33#include "sopnamsp.h"
     
    55#include <stdlib.h>
    66#include "pexceptions.h"
     7
     8#define TVECTOR_CC_BFILE  // avoid extern template declarations
    79#include "tvector.h"
    810
  • trunk/SophyaLib/TArray/tvector.h

    r2884 r3831  
    123123typedef TVector<r_8> Vector;
    124124
     125//--------- extern template declarations (if needed) -----------
     126#if defined ( NEED_EXT_DECL_TEMP ) && !defined( TVECTOR_CC_BFILE )
     127extern template class TVector<uint_1>;
     128extern template class TVector<uint_2>;
     129extern template class TVector<uint_4>;
     130extern template class TVector<uint_8>;
     131extern template class TVector<int_1>;
     132extern template class TVector<int_2>;
     133extern template class TVector<int_4>;
     134extern template class TVector<int_8>;
     135extern template class TVector<r_4>;
     136extern template class TVector<r_8>;
     137extern template class TVector< complex<r_4> >;
     138extern template class TVector< complex<r_8> >;
     139#ifdef SO_LDBLE128
     140extern template class TVector<r_16>;
     141extern template class TVector< complex<r_16> >;
     142#endif
     143#endif  // Fin de if defined ( NEED_EXT_DECL_TEMP )
     144
    125145} // Fin du namespace
    126146
Note: See TracChangeset for help on using the changeset viewer.