| Title: | Digital Fortran |
| Notice: | Read notes 1.* for important information |
| Moderator: | QUARK::LIONEL |
| Created: | Thu Jun 01 1995 |
| Last Modified: | Fri Jun 06 1997 |
| Last Successful Update: | Fri Jun 06 1997 |
| Number of topics: | 1333 |
| Total number of notes: | 6734 |
I tried to link Fortran Main program and C function. I get unresolved error.
Is there something I am missing here? I have listed some example files and
the make file. I would appreciate if someone knows about this problem.
Ravi.
C*****************************************************************************
* FILE: mpi_2dfft.f
C*****************************************************************************
program mpi_2dfft
include 'mpif.h'
EXTERNAL timing_fgettod
! timing variables
integer times1(2), times2(2) ! times from timing_fgettod
.
.
call timing_fgettod(%REF(times1))
.
.
end
/*****************************************************************************
* FILE: timing_fgettod.c
*****************************************************************************/
#include <stdio.h>
#include <sys/time.h>
void timing_fgettod (int times[2]) {
struct timeval tv;
gettimeofday(&tv, (struct timeval*)0);
times[0] = tv.tv_sec;
times[1] = tv.tv_usec;
}
##############################################################################
# FILE: fft.make
##############################################################################
FTN = f77
CC = cc
FLAGS = -g
LIB_LIST = -lmpi -lrt -pthread
FOR_LIB = -lfor -lFutil -lots -lUfor
X11LIB = -lX11
MATHLIB = -lm
OBJ = mpi_2dfft
SRC = mpi_2dfft.f ser_fft.f timing_fgettod.c
${OBJ} : ${SRC}
${FTN} ${FLAGS} -v -o ${OBJ} $(SRC) $(LIB_LIST)
##############################################################################
# FILE:output file
##############################################################################
f77 -g -v -o mpi_2dfft mpi_2dfft.f ser_fft.f timing_fgettod.c -lmpi -lrt
-pthrea
d
/usr/lib/cmplrs/fort/decfort -g -switch fe_platinum -reentrancy threaded -O0
-o
/tmp/forAAAaajyka.o mpi_2dfft.f ser_fft.f
/usr/bin/cc -g -v -o mpi_2dfft -pthread /usr/lib/cmplrs/fort/for_main.o -O0
/tmp
/forAAAaajyka.o timing_fgettod.c -lmpi -lrt -lUfor -lfor -lFutil -lm_4sqrt -lm
-
lots
/usr/lib/cmplrs/cc/gemc_cc -D__LANGUAGE_C__ -D__unix__ -D__osf__ -D__alpha
-D_SY
STYPE_BSD -D_LONGLONG -DLANGUAGE_C -Dunix -DSYSTYPE_BSD -I/usr/include
-preempt_
symbol -D_REENTRANT -g2 -O0 -std0 -o timing_fgettod.o timing_fgettod.c
/usr/lib/cmplrs/cc/gemc_cc:
0.12u 0.03s 0:00 100% 0+10k 0+23io 0pf+0w 10stk+1504mem
/usr/lib/cmplrs/cc/ld -o mpi_2dfft -g2 -O0 -call_shared
/usr/lib/cmplrs/cc/crt0.
o /usr/lib/cmplrs/fort/for_main.o /tmp/forAAAaajyka.o timing_fgettod.o
-qlmpi_r
-lmpi -qlrt_r -lrt -qlUfor_r -lUfor -qlfor_r -lfor -qlFutil_r -lFutil
-qlm_4sqrt
_r -lm_4sqrt -qlm_r -lm -qlots_r -lots -lpthread -lmach -lexc -lc
ld:
Unresolved:
timing_fgettod_
/usr/lib/cmplrs/cc/ld:
0.12u 0.04s 0:00 80% 0+15k 0+15io 0pf+0w 15stk+2064mem
fort: Severe: Failed while trying to link.
*** Exit 1
Stop.
[Posted by WWW Notes gateway]
| T.R | Title | User | Personal Name | Date | Lines |
|---|---|---|---|---|---|
| 1294.1 | QUARK::LIONEL | Free advice is worth every cent | Mon May 12 1997 16:57 | 7 | |
The UNIX Fortran default is to downcase external names and append an underscore. You can either add a trailing underscore to your C routine name or add the following line in your Fortran code: !DEC$ ALIAS timing_fgettod,'timing_fgettod' Steve | |||||
| 1294.2 | Minor: isn't %REF() unnecessary? | SUBPAC::FARICELLI | Mon May 12 1997 17:03 | 5 | |
Minor nit: isn't the use of %REF() unnecessary, since Fortran always passes by reference (address)? -- John Faricelli | |||||
| 1294.3 | It worked | NNTPD::"[email protected]" | Kotehal Ravindranath | Mon May 12 1997 17:35 | 2 |
It worked. Thank you for your help. [Posted by WWW Notes gateway] | |||||
| 1294.4 | QUARK::LIONEL | Free advice is worth every cent | Mon May 12 1997 21:51 | 3 | |
Yes, the %REF is unnecessary in this case.
Steve
| |||||