error calling c functions from gfortran

Tobias Burnus burnus@net-b.de
Sat Feb 10 17:50:00 GMT 2007


Hi,

Steve Kargl wrote:
>> I get the wrong answer calling c programs from a gfortran program. The same c 
>> functions work when called from a c main program. I guess I need some kind of 
>> interface statement to call c functions from gfortran.
> For others on the list, I've already answered Mike in a private
> email.  He needs to change his c code from pass-by-value to
> pass-by-reference.
>   
I only want to point out that gfortran 4.3 also supports pass-by-value
using the VALUE statement/attribute in the interface block. (It also
works for Fortran subroutines.)

Alternatively, enclosing the variables in %VAL() in the call should work
as well (DEC extension).

Nonetheless, as Tobias S. pointed out, using the ishift intrinsic is the
better approach in this case.

Tobias B.



More information about the Fortran mailing list