<div class="gmail_quote">On Wed, Nov 9, 2011 at 12:52, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div id=":2tg"> So what both Satish's and Ethan's email are saying is so long as you tell the Fortran function the interface that shows the type being returned you can "trick" the Fortran into thinking that data type is just coming from another Fortran routine.<br>
<br>
I think this should resolve your issues and everything should be straightforward (no need for transfer function). Please let us know if this is problematic.</div></blockquote></div><div><br></div><div>Thanks everyone. This works, and in hindsight, I should have looked at snes/examples/tutorials/ex5f90.F because it does this with SNESGetApplicationContext.</div>
<div><br></div><div>The unfortunate thing is that it appears that the user needs to write a custom interface for each such function in order to get the compiler to pass the pointer in a useful way. Is there a way for us to put some interface definitions into the library? An (ugly) alternative would be to provide some CPP macros that the user can use to get interface definitions without needing to hand-type it (they would pass in their user-defined type).</div>
<div><br></div><div>How can we manage multiple contexts with different types in the same file? It looks like perhaps I can put the interface definitions in different modules, which I can import at subroutine granularity. If I want to get the context out of two MatShells inside the same function, I would have to write helper functions so that they can import different interface definitions via different modules?</div>