[petsc-dev] circular dependencies SLEPc

Smith, Barry F. bsmith at mcs.anl.gov
Mon Jul 8 22:44:04 CDT 2019



> On Jul 8, 2019, at 10:37 PM, Jed Brown <jed at jedbrown.org> wrote:
> 
> "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
> model.
> 
> 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.

   Are you saying we need something like PetscPlugInRegister(PetscErrorCode (*)(void)) that can be called before PetscInitialize() by plugin libraries that 
registers the function that PetscInitialize() than calls? This is doable, just needs to use malloc() directly and cannot use PETSc's FList constructs.






More information about the petsc-dev mailing list