[petsc-users] How to use petsc in a dynamically loaded shared library?
Matthew Knepley
knepley at gmail.com
Tue Jul 24 10:36:02 CDT 2012
On Tue, Jul 24, 2012 at 10:24 AM, Florian Beck <Flo.44 at gmx.de> wrote:
> On Sun Jul 22 11:28:18 CDT 2012 Jed Brown jedbrown at mcs.anl.gov wrote:
>
> >>
> >> Back to my problem, I think I have a problem with the initialisation of
> >> the petsc library and therefore I'm not able to create vectors in the
> >> right way. I call PetscInitialize() as in the examples shown. Are there
> >> some special functions to check if everthing is initialized correct?
> >>
> >> My example works fine except the destroying of the vectors, for the
> >> first testing I run it serial. Can that cause my problem?
> >>
> >>
> >Can you send us a reduced test case to demonstrate the problem?
>
> Hi I think I have solved my problem, but I don't know why. The things I
> have change to my previous version are the following. In my previous
> version I moved my installed petsc library. I read that this could cause
> some problems. And I had the following construct: executable load shared
> library A with dlopen. I linked the petsc library to library B and B to A.
> Now I have change it to: executable load lib A. And I have linked petsc to
> A.
>
> I try to reproduce it in a smaller example. If the smaller example has the
> same problems I will send it to you. Or can you say without the example
> what the problem is?
>
You have to be careful with global symbols and dlopen(). If you do not link
the shared library, you have to make sure
all parts of your code see the same globals from the library.
Matt
--
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120724/92e669ac/attachment.html>
More information about the petsc-users
mailing list