LF95 Linux User's Guide - Lahey Computer Systems
LF95 Linux User's Guide - Lahey Computer Systems
LF95 Linux User's Guide - Lahey Computer Systems
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Chapter 3 Mixed Language ProgrammingThis section does not discuss Fortran subroutines, which are called from C as “void” functions.This concept is illustrated in a later section, “Passing and Receiving Arguments” onpage 58.Table 8: Declaring C Result Types for Fortran Function TypesFortran Function Type C Result Type ExampleINTEGER(1) signed char result = myfunc_();INTEGER(2) short int result = myfunc_();INTEGER(4) long int result = myfunc_();INTEGER(8) long long int result = myfunc_();LOGICAL(1) unsigned char result = myfunc_();LOGICAL(2) short int result = myfunc_();LOGICAL(4) long int result = myfunc_();LOGICAL(8) long long int result = myfunc_();REAL(4) float result = myfunc_();REAL(8) double result = myfunc_();REAL(16) long double result = myfunc_();COMPLEX(4) void myfunc_(&result);COMPLEX(8) void myfunc_(&result);COMPLEX(16) void myfunc_(&result);CHARACTER(LEN=*) void myfunc_(&result,len);Derived Type not applicable not applicableFor example, the Fortran function:integer function foo(i,j)integer :: i, j::end function foocorresponds to the C prototype:long int foo(long int *i, long int *j);To illustrate returning an assumed-length character value, the Fortran function:56 <strong>Lahey</strong>/Fujitsu <strong>Linux</strong>64 Fortran User’s <strong>Guide</strong>