For some reason, %fortranbindc is mapping fundamental pointer types (int*, long*, etc) as type(C_PTR) dummy arguments.
For example:
%fortranbindc;
int example2_f2(int *b);
Generates:
function example2_f2(b) &
bind(C, name="example2_f2") &
result(fresult)
use, intrinsic :: ISO_C_BINDING
type(C_PTR) :: b
integer(C_INT) :: fresult
end function
Where I expected it to generate:
function example2_f2(b) &
bind(C, name="example2_f2") &
result(fresult)
use, intrinsic :: ISO_C_BINDING
integer(C_INT) :: b ! Note the absence of the "value" keyword.
integer(C_INT) :: fresult
end function
I know there is almost no way to tell if an int* is just an inout argument or an array, but I believe the most sensible thing to do would be to generate an inout dummy, not an arbitrary pointer.
Or at most, generate a dimension(*), target dummy (i.e. assume pointers are arrays of unknown size, which size 1 is an special case)?
For some reason, %fortranbindc is mapping fundamental pointer types (
int*
,long*
, etc) astype(C_PTR)
dummy arguments.For example:
Generates:
Where I expected it to generate:
I know there is almost no way to tell if an
int*
is just an inout argument or an array, but I believe the most sensible thing to do would be to generate an inout dummy, not an arbitrary pointer. Or at most, generate adimension(*), target
dummy (i.e. assume pointers are arrays of unknown size, which size 1 is an special case)?