Cython, C and Fortran

I would like to ask your help about calling the fortran function through C functions. These C functions will be used in python code through cython. Putting things together, I have this circuit:

Cython Module → C function → Fortran, where → means “calls”.

Currently, I have managed to call the C function from cython, but it's hard for me to call the fortran function. Can you help me? (A simple example would be great).

Thanks in advance. Edit: I am using gcc 4.1.2. And gfortran

+3
source share
3 answers

. Fortran C C Fortran ISO C Fortran. Fortran Fortran , C. "" , , . ISO C Fortran 2003, , gfortran 4.3 Intel ifort.

Fortran C, Fortran C C- , . gfortran " ". ISO C , . " " .

() Fortran , C:

subroutine test ( varint1, varflt2 )  bind ( C, name="MyTest" )

   use iso_c_binding

   integer (kind=c_int32_t), intent (in) :: varint1
   real (kind=c_float), intent (out) :: varflt2

C "MyTest" Fortran - , Fortran. ! ... . gfortran .

+7

, fwrap, C, cython python fortran. , -, , .

+1

Google ( Fortran C). http://www.yolinux.com/TUTORIALS/LinuxTutorialMixingFortranAndC.html

Fortran-IV Macro-10 35 , , .

0

Source: https://habr.com/ru/post/1779098/