Fortran C interoperabiltiy documentation

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Fortran C interoperabiltiy documentation

NightStrike
https://gcc.gnu.org/onlinedocs/gfortran/Working-with-Pointers.html

"If a pointer is a dummy-argument of an interoperable procedure, it
usually has to be declared using the VALUE attribute. void* matches
TYPE(C_PTR), VALUE, while TYPE(C_PTR) alone matches void**."

What does "usually" mean in this context?  Under what conditions do we
have to do this?
Reply | Threaded
Open this post in threaded view
|

Re: Fortran C interoperabiltiy documentation

N.M. Maclaren
On Jun 21 2019, NightStrike wrote:

>https://gcc.gnu.org/onlinedocs/gfortran/Working-with-Pointers.html
>
>"If a pointer is a dummy-argument of an interoperable procedure, it
>usually has to be declared using the VALUE attribute. void* matches
>TYPE(C_PTR), VALUE, while TYPE(C_PTR) alone matches void**."
>
>What does "usually" mean in this context?  Under what conditions do we
>have to do this?

Just as it says.  Use VALUE to match 'void *' and not to match 'void **';
the former is more common in C interfaces.


Regards,
Nick Maclaren.