[petsc-dev] Dev Manual Blurb on PETSC_INTERN and PETSC_EXTERN ?

Barry Smith bsmith at mcs.anl.gov
Fri May 20 14:35:47 CDT 2016


> On May 20, 2016, at 3:50 AM, Patrick Sanan <patrick.sanan at gmail.com> wrote:
> 
> A short blurb in the dev manual re PETSC_EXTERN and PETSC_INTERN might
> be helpful for contributors. There have been some changes recently and
> some of the older advice on petsc-dev is stale (there is discussion of
> deprecated things like PETSC_INTERN_C, notes from when PETSc compiled
> into several separate shared libraries, etc.).
> 
> My current understanding is something like the folllowing.
> 
>    PETSC_EXTERN : for symbols which should be visible to other shared
> libraries, *including plugins* .
> 
>    PETSC_INTERN : for symbols which need to be visible across
> compilation units, but only within the PETSc shared library.

  actually only within a SINGLE PETSc shared library. Sometimes people forget that the PETSc libraries can be built as sys, vec, mat, dm, ksp, snes, ts so anything that is private but still needed in more than one of the libraries needs a PETSC_EXTERN. If someone makes a mistake it is only detected with the multiple library builds.

> 
>    In both cases, the names are demangled if C++ is involved.
> 
> If that's right, I can make a patch to add it to the manual (at the
> end of Section 2.2, say).

   Thanks. Go ahead. We "improved" this stuff in PETSc a good deal but did not properly update the developers guide.

  Barry





More information about the petsc-dev mailing list