[petsc-dev] meaning of PETSC_USE_EXTERN_CXX?

Barry Smith bsmith at mcs.anl.gov
Tue Mar 5 18:02:54 CST 2013


   We have --with-clanguage=c or c++   (this is already weird, most packages don't strife to be built either with C or C++) 
                  --with-c-support=0,1             (compile with C++ but with C bindings so C application can use it)

              User Code                PETSc compiled with 
          ------------------------          C                  C++
                    C                           x                   x
                    C++                       x                   x

            Hope back into Satish's way back machine and ask the question "why do we have this c-support business"? Seems like it complicates
life a lot?

   Barry


On Mar 5, 2013, at 5:55 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote:

> 
> On Tue, Mar 5, 2013 at 5:49 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
> From the below I am assuming that PETSC_USE_EXTERN_CXX is equivalent to --with-c-support   Is this correct?
> 
> Yes,
> 
> config/PETSc/utilities/languages.py-    '''Check c-support c++-support and other misc tests'''
> config/PETSc/utilities/languages.py-    if self.clanguage == 'Cxx' and self.framework.argDB['with-c-support']:
> config/PETSc/utilities/languages.py-      self.cSupport = 1
> config/PETSc/utilities/languages.py:      self.addDefine('USE_EXTERN_CXX', '1')
> config/PETSc/utilities/languages.py-      self.framework.logPrint('Turning off C++ name mangling')
> config/PETSc/utilities/languages.py-    else:
> config/PETSc/utilities/languages.py-      self.cSupport = 0
> 
> 
> Matt, what is this about?
> 
> config/PETSc/utilities/languages.py-  def configureExternC(self):
> config/PETSc/utilities/languages.py-    '''Protect C bindings from C++ mangling'''
> config/PETSc/utilities/languages.py-    if self.clanguage == 'C':
> config/PETSc/utilities/languages.py:      self.addDefine('USE_EXTERN_CXX',' ')
> config/PETSc/utilities/languages.py-    return
> config/PETSc/utilities/languages.py-
> config/PETSc/utilities/languages.py-  def configureFortranLanguage(self):
>  
> 
>    And I assume that --with-c-support means that PETSc is compiled with C++ but does not use name mangling   Is this correct?
> 
> Yes
>  
> 
>    If the above two are correct does the name PETSC_USE_EXTERN_CXX actually correlate to what it means? Could it be changed to something meaningful?
> 
> --with-extern-c-interface (or --with-c-interface) and PETSC_USE_EXTERN_C_INTERFACE?
>  
> 
>     Please explain,
> 
>      Barry
> 
> 
> #if defined(PETSC_CLANGUAGE_CXX) && !defined(PETSC_USE_EXTERN_CXX) && !defined(__cplusplus)
> #error "PETSc configured with --with-clanguage=c++ and NOT --with-c-support - it can be used only with a C++ compiler"
> #endif
> 
> 




More information about the petsc-dev mailing list