<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Aug 4, 2015 at 12:15 PM, Martin Vymazal <span dir="ltr"><<a href="mailto:martin.vymazal@vki.ac.be" target="_blank">martin.vymazal@vki.ac.be</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
 I'm trying to create a small C++ class to wrap the 'Vec' object. This class<br>
has an internal pointer to a member variable of type Vec, and in its<br>
destructor, it calls VecDestroy. Unfortunately, my test program segfaults and<br>
this seems to be due to the fact that the destructor of the wrapper class is<br>
called after main() calls PetscFinalize(). Apparently VecDestroy performs some<br>
collective communication, so calling it after PetscFinalize() is too late. How<br>
can I fix this?<br></blockquote><div><br></div><div>1) Declare your C++ in a scope, so that it goes out of scope before PetscFinalize()</div><div><br></div><div>2) Is there any utility to this wrapper since everything can be called directly from C++?</div><div><br></div><div>  Thanks,</div><div><br></div><div>     Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Thank you,<br>
<br>
 Martin Vymazal<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">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></div>