Help! Fortran call from C on LinuxPPC-R5
T.Ueda
ueda at power.elec.kitami-it.ac.jp
Thu Jul 15 18:57:42 EST 1999
Hi,
I am checking a simple program that Fortran calls C using LinuxPPC-R5 on
PowerBookG3.
It seems that real fuction call of fortran may wrong.
Why 2147482368.000000 in the case of calling real function?? ( real and
float are not same bytes?)
Anyone know the reason?
Tac at Japan
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[complile& run]
f77 -c f2.f
f77 -c f22.f
f77 -c f3.f
f77 -c f33.f
gcc main.c f2.o f22.o f3.o f33.o
a.out
Result: 5 --> 25 2147482368.000000 125 125.000000
Why 2147482368.000000?? ( real and float are not same size?)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* (1)main.c */
#include <stdio.h>
int main() {
float y22, y33;
int x=5;
int y2, y3;
y2=f2_(&x);
y22=f22_(&x);
f3_(&x, &y3);
f33_(&x, &y33);
printf("%d --> %d %f %d %f \n", x, y2, y22, y3, y33);
return 0;
}
~~~~~~~~~~~~~~~~~~
C (2)f2.f
integer function f2(x)
integer x
f2=x*x
end
~~~~~~~~~~~~~~~~~~
C (3) f22.f
real function f22(x)
integer x
f22=x*x
end
~~~~~~~~~~~~~~~~~~
C (4) f3.f
subroutine f3(x,y)
integer x, y
y=x*x*x
end
~~~~~~~~~~~~~~~~~~
C (5) f33.f
subroutine f33(x,y)
integer x
real y
y=x*x*x
end
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 1386 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/19990715/13bd23b7/attachment.bin>
More information about the Linuxppc-dev
mailing list