What type and value does PETSC_COMM_WORLD in the following header expand to?
Is it just a redefinition for MPI_Comm
with extern
scope?
#define PETSC_EXTERN extern PETSC_VISIBILITY_PUBLIC
PETSC_EXTERN MPI_Comm PETSC_COMM_WORLD;
It's simple text substitution, so you end up with:
extern PETSC_VISIBILITY_PUBLIC MPI_Comm PETSC_COMM_WORLD;
Hence the type of PETSC_COMM_WORLD
is PETSC_VISIBILITY_PUBLIC MPI_Comm
and so depends on the definition of PETSC_VISIBILITY_PUBLIC
, which hasn't been provided.
From a cursory search of the net, it will be empty when building the petsc
DLL or the attribute __attribute__((visibility ("default")))
when using it.
The extern
itself doesn't control or modify the type (nor does that attribute for that matter) it simply states that this variable is not being created here, but should be made available elsewhere.
The value depends entirely on where you're defining the variable, what scope it's at, whether you initialise it, and so on.