[petsc-dev] circular dependencies SLEPc

Jed Brown jed at jedbrown.org
Mon Jul 8 22:37:06 CDT 2019

"Smith, Barry F. via petsc-dev" <petsc-dev at mcs.anl.gov> writes:

>> On Jul 8, 2019, at 9:53 PM, Jakub Kruzik via petsc-dev <petsc-dev at mcs.anl.gov> wrote:
>> Just to clarify, the suggested solution is a plug-in sitting anywhere in the PETSc source tree with postponed compilation and using __attribute__((constructor)) to register (as in libCEED) for static libraries?
>   Yes, this is my understanding. Good luck.

There is some nontrivial infrastructure that would be needed for this

1. This new component needs to be built into a new library such as
   libpetsc-plugin.a (when static).

2. Users need to know when they should link this module.  They'll need a
   link line something like -lpetsc-plugin -lslepc -lpetsc in this case.
   It would need to be specified correctly in makefiles and pkg-config.

3. Anything with __attribute__((constructor)) runs *before* main, thus
   before PetscInitialize.  There would need to be a new mechanism to
   register a callback to be run at the end of PetscInitialize.

More information about the petsc-dev mailing list