Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Mixed Programming Fortran and C
- MODULE my_fortran
- USE iso_c_binding
- IMPLICIT NONE
- CONTAINS
- SUBROUTINE my_subroutine(a,b) BIND(C,name="my_sub")
- INTEGER(c_int),INTENT(in),VALUE :: a
- REAL(C_DOUBLE),INTENT(out) :: b
- ...
- END SUBROUTINE
- END MODULE
- void my_sub(int, double *);
- #include "my_sub.h"
- int main(){
- double b;
- int a=3;
- my_sub(a,&b);
- ...
- }
- double x, y;
- ..................
- x = 2.0;
- y = gamma_(&x)
- float --- REAL (this is typical, but not always the case)
- double --- REAL*8
- extern void read_(int *small, float *medium, double *large);
- read_(&small, &medium, &large);
- SUBROUTINE READ(small,medium,large)
- INTEGER small
- REAL medium
- DOUBLE large
Advertisement
Add Comment
Please, Sign In to add comment