* Help! C FORTRAN on ALPHA/OSF version 1.3
@ 1994-03-23 15:12 James Kent Blackburn
1994-03-23 17:28 ` Steve Lionel
0 siblings, 1 reply; 2+ messages in thread
From: James Kent Blackburn @ 1994-03-23 15:12 UTC (permalink / raw)
I have found a problem in having a C main function call a FORTRAN
subroutine while using the latest version (1.3) of the OSF operating
system on an Alpha workstation. This same code works great on machines
using the version 1.2 OSF operating system. Running this very simple test
program causes a segmentation fault immediately upon entering the main
function! The code and Makefile is shown below. Please send replies via
internet email to kent@kentaurus.gsfc.nasa.gov. Thanks...
======================================================================
alpha> cat hjunk.c
/*
filename: hjunk.c
purpose: c - wrapper for fortran junk subroutine
author: Kent Blackburn - kent@kentaurus.gsfc.nasa.gov
*/
#include <stdio.h>
int main (argc,argv)
int argc;
char **argv;
{
void junk_();
junk_();
return(0);
}
alpha> cat junk.f
C Simple fortran subroutine called by C
C
subroutine junk
print*,'hello world'
return
end
alpha> cat Makefile
# Makefile for junk program:
F77LIBS = -L/usr/lib -ldnet_stub -lUfor -lfor -lFutil -lm -lots -lc
CFLAGS = -I./ -g
all: junk
junk: hjunk.o junk.o
$(CC) -o junk $(CFLAGS) hjunk.o junk.o $(F77LIBS)
FFLAGS = -c -g
junk.o: junk.f
$(FC) $(FFLAGS) $<
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: Help! C FORTRAN on ALPHA/OSF version 1.3
1994-03-23 15:12 Help! C FORTRAN on ALPHA/OSF version 1.3 James Kent Blackburn
@ 1994-03-23 17:28 ` Steve Lionel
0 siblings, 0 replies; 2+ messages in thread
From: Steve Lionel @ 1994-03-23 17:28 UTC (permalink / raw)
In article <2mpm9h$4e9@paperboy.gsfc.nasa.gov>,
kent@kentaurus.dftsrv.gsfc.nasa.gov (James Kent Blackburn) writes:
|>I have found a problem in having a C main function call a FORTRAN
|>subroutine while using the latest version (1.3) of the OSF operating
|>system on an Alpha workstation. This same code works great on machines
|>using the version 1.2 OSF operating system. Running this very simple test
|>program causes a segmentation fault immediately upon entering the main
|>function! The code and Makefile is shown below. Please send replies via
|>internet email to kent@kentaurus.gsfc.nasa.gov. Thanks...
I tried this on a DEC OSF/1 V2.0 baselevel and it worked fine. I don't have
ready access to a V1.3 system to try it there.
We generally recommend using the f77 driver to link mixed Fortran and
C code. Use the -nofor_main switch to tell it that the main program isn't
Fortran. Give that a try and see what happens.
--
Steve Lionel Mail: lionel@quark.enet.dec.com
SDT Languages Group WWW: http://www.digital.com/pub/
Digital Equipment Corporation Digital/info/html/slionel.html
110 Spit Brook Road, ZKO2-3/N30
Nashua, NH 03062-2698 "Free advice is worth every cent"
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1994-03-23 17:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1994-03-23 15:12 Help! C FORTRAN on ALPHA/OSF version 1.3 James Kent Blackburn
1994-03-23 17:28 ` Steve Lionel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox