Software Archive
Read-only legacy content
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
17060 Discussions

calling a fortran subroutine from a C main routine

Intel_C_Intel
Employee
483 Views
On Sun UNIX, I used to be able to call a fortran routine from C main routine. In detail,
----- C routine: test2_f_land_2.c
void main(){
int f_land_2_();
printf(%c", f_land_2_(&lat, &lon) );
---- Fortrain subroutine
integer function f_land_2(lat,long)
---------
But when I ported the codes to Tru64 Unix, and compile it as
test2 : test2.o f_land_2.o
$(CC) test2.o f_land_2.o $(LIBS) -o test2
I get an error:
cc -I./ -I~sk/tp/prog/libraries/headers -g -c test2_f_land_2.c
f77 test2_f_land_2.o f_land_2.o -lm -o test2_f_land_2
ld:
/usr/lib/cmplrs/fort90/for_main.o: main: multiply defined
Unresolved:
MAIN__
f77: Severe: Failed while trying to link.
*** Exit 1
Stop.

Can anyone suggest how I can properly link? I tried f90 & f95 - no luck
Thanks
0 Kudos
0 Replies
Reply