"Smith, Barry F. via petsc-dev" <[email protected]> writes:
>> On Jul 8, 2019, at 9:53 PM, Jakub Kruzik via petsc-dev >> <[email protected]> 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.
