[petsc-dev] meaning of PETSC_USE_EXTERN_CXX?

Matthew Knepley knepley at gmail.com
Tue Mar 5 18:03:33 CST 2013


On Tue, Mar 5, 2013 at 6: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?
>

I think this is Satish (blame gets confused by the move). Don't we wrap the
entire interface in EXTERN_C
so that C++ people who include the header do not mangle PETSc functions?

   Matt


> 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
>>
>
>
>


-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20130305/0d8e2043/attachment.html>


More information about the petsc-dev mailing list