Changeset 3831 in Sophya for trunk/SophyaLib/BaseTools


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/BaseTools
Files:
3 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
Note: See TracChangeset for help on using the changeset viewer.