<div dir="ltr"><div dir="ltr">On Mon, Jul 8, 2019 at 10:37 PM Jed Brown via petsc-dev <<a href="mailto:petsc-dev@mcs.anl.gov">petsc-dev@mcs.anl.gov</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">"Smith, Barry F. via petsc-dev" <<a href="mailto:petsc-dev@mcs.anl.gov" target="_blank">petsc-dev@mcs.anl.gov</a>> writes:<br>
<br>
>> On Jul 8, 2019, at 9:53 PM, Jakub Kruzik via petsc-dev <<a href="mailto:petsc-dev@mcs.anl.gov" target="_blank">petsc-dev@mcs.anl.gov</a>> wrote:<br>
>> <br>
>> 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?<br>
><br>
>   Yes, this is my understanding. Good luck.<br>
<br>
There is some nontrivial infrastructure that would be needed for this<br>
model.<br>
<br>
1. This new component needs to be built into a new library such as<br>
   libpetsc-plugin.a (when static).<br>
<br>
2. Users need to know when they should link this module.  They'll need a<br>
   link line something like -lpetsc-plugin -lslepc -lpetsc in this case.<br>
   It would need to be specified correctly in makefiles and pkg-config.<br>
<br>
3. Anything with __attribute__((constructor)) runs *before* main, thus<br>
   before PetscInitialize.  There would need to be a new mechanism to<br>
   register a callback to be run at the end of PetscInitialize.<br>
</blockquote></div><br clear="all"><div>I think the simpler course it just to declare that this does not work outside of dynamic linking.</div><div>The number of platforms that do not have dynamic linking is small, and we are not putting</div><div>anything critical here. This decision can be reevaluated, but for now it makes everything much</div><div>much simpler.</div><div><br></div><div>   Matt</div><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>