<div dir="ltr">Hello Samuel,<div><br></div><div>Not an expert on pointers, but I believe that the problem is you are trying to use the pointer as if it were an array. Maybe? In any case, when I was using this routine, I would always use a separate routine, using the pointer as argument, to do the actual business. So with your example it would be something like:</div><div><br></div><div>CALL VecGetArrayReadF90(vecX,vecX_pt,ierr); CHKERRQ(ierr)<br></div><div><br></div><div>CALL DoSomething(vecX_pt)</div><div><br></div><div>CALL VecRestoreArrayReadF90(vecX,vecX_pt,ierr); CHKERRQ(ierr)<br></div><div><br></div><div>subroutine DoSomething(X)</div><div><br></div><div>  PetscScalar :: X(size)</div><div><br></div><div>  ...</div><div>  ...</div><div><br></div><div>end <span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">subroutine DoSomething</span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">In other words, you pass the pointer to a routine and then use the argument as if it were a normal array within the routine. To be honest, I know nothing about the internal pointer business, so I hope I am not misleading you, but at least when I was doing this it was working.</span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Cheers</span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Timothee</span></div><div><br></div><div>  </div></div><div class="gmail_extra"><br><div class="gmail_quote">2018-03-23 15:10 GMT+01:00 Samuel Lanthaler <span dir="ltr"><<a href="mailto:s.lanthaler@gmail.com" target="_blank">s.lanthaler@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi all,<br>
<br>
I am having trouble using the function VecGetArrayReadF90 under 
gfortran. I have created a minimal example and put it in the attachment.
 Basically, it appears that the input pointer is empty upon return from 
VecGetArrayReadF90. The code runs fine, when compiled with ifort, so I 
don't know what's going on.<br>
<br>
I am attaching the code and makefile that I used, as well as the command
 line output that I can see. Though the errors are just to do with the 
fact that the output pointer is empty, so the command line output is not
 all that helpful...<br>
<br>
Thanks in advance for your help!<br>
Sam</div>
</blockquote></div><br></div>