g77

Mixed programming: Calling FORTRAN from C

南楼画角 提交于 2019-12-11 11:43:00
问题 I have to do a proof of concept on calling FORTRAN subroutines from C/C++. I don't know what I am in right direction, please guide me.... What I did is... I wrote the following FORTRAN code INTEGER*4 FUNCTION Fact (n) INTEGER*4 n INTEGER*4 i, amt amt = 1 DO i = 1, n amt = amt * i END DO Fact = amt END SUBROUTINE Pythagoras (a, b, c) REAL*4 a REAL*4 b REAL*4 c c = SQRT (a * a + b * b) END compiled it using g77 as g77.exe -c FORTRANfun.for I wrote following c code... #include <stdio.h> extern

“DATA INT / 'STRING' /” problem when compiling with gfortran

浪尽此生 提交于 2019-12-01 11:27:29
I have some old (~1995) legacy fortran code which is compiled with g77 compiler and fails on gfortran. The problem is in following lines (incompatible types conversion, character to integer): INTEGER CKYAN DATA CKYAN / 'KYAN' / The variable CKYAN is used only once as trigger: IF(IWVTX.EQ.CKYAN)THEN CALL FDCVERTEXSWITCHTOKYAN() ENDIF The integer IWVTX is read from input file (string 'KYAN' or some other string). I do not have any significant experience in fortran and I fail to find any documentation on what is going on when I initialize integer variable from the string. I have checked with the

“DATA INT / 'STRING' /” problem when compiling with gfortran

做~自己de王妃 提交于 2019-12-01 08:34:48
问题 I have some old (~1995) legacy fortran code which is compiled with g77 compiler and fails on gfortran. The problem is in following lines (incompatible types conversion, character to integer): INTEGER CKYAN DATA CKYAN / 'KYAN' / The variable CKYAN is used only once as trigger: IF(IWVTX.EQ.CKYAN)THEN CALL FDCVERTEXSWITCHTOKYAN() ENDIF The integer IWVTX is read from input file (string 'KYAN' or some other string). I do not have any significant experience in fortran and I fail to find any