[petsc-users] How to use petsc in a dynamically loaded shared library?

Jed Brown jedbrown at mcs.anl.gov
Sat Jul 21 12:55:34 CDT 2012


Please reply to email rather than starting a new thread. Your email client
might be dropping headers.

On Sat, Jul 21, 2012 at 12:48 PM, Florian <flo.44 at gmx.de> wrote:

> >On Sat, Jul 21, 2012 at 12:26 PM, Florian <flo.44 at gmx.de> wrote:
> >
> >> I made it to step with gdb now in VecCreate(). The problem is inside the
> >> VecCreate
> >> function the new created vector vec has all the adresses set. But when
> I'm
> >> stepping
> >> back in my function the addresses are all 0x0.
> >>
> >
> >Let VecCreate finish.
>
> What do you mean? I step to the last line in VecCreate and after the last
> line back.
>

The last line is

  *vec = v;

which makes your pointer point at the new vector.


>
> >
> >
> >>
> >> Another question is, what happens with my created vector. I mean I
> create
> >> a Object
> >> with Vec v and inside the VecCreate function the addres of my object v
> is
> >> first set
> >> to PETSC_NULL and later to the Vec which is created inside the VecCreate
> >> function.
> >> It seems like I never could destroy my created vector. Can somebody
> >> explain this to me?
> >>
> >
> >The new object is created, then your pointer is made to point at the new
> >object.
>
> So if I get it right I create with "Vec v;" only a pointer? But why is it
> possible before I call VecCreate
> to have a look at a vector object. I mean in ddd I can display a full
> vector object.
>
>
In petscvec.h, you will find

typedef struct _p_Vec *Vec;

Of course DDD allows you to follow an invalid pointer.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120721/a1797c17/attachment.html>


More information about the petsc-users mailing list