Xref: utzoo comp.lang.c:39350 comp.lang.fortran:5403 comp.unix.questions:31428 Newsgroups: comp.lang.c,comp.lang.fortran,comp.unix.questions Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!van-bc!ubc-cs!unixg.ubc.ca!buckland From: buckland@ucs.ubc.ca (Tony Buckland) Subject: Re: Calling C from FORTRAN under Unix Message-ID: <1991May17.163421.11604@unixg.ubc.ca> Sender: news@unixg.ubc.ca (Usenet News Maintenance) Nntp-Posting-Host: swiss.ucs.ubc.ca Organization: University of B.C. Computing Services References: <5343@dftsrv.gsfc.nasa.gov> Date: Fri, 17 May 1991 16:34:21 GMT In article <5343@dftsrv.gsfc.nasa.gov> packer@amarna.gsfc.nasa.gov writes: >On a Unix system I want to call a C routine from a FORTRAN >program. The linker says the C routine is undefined. >To anyone familiar with this problem: what is the way around it? The technique I have used is to write a little interface routine with its entry point having the name the FORTRAN program wants to call, and which calls the entry point the C routine provides. This was done to call a C library routine. It works as long as the C library routine is FORTRAN-callable in the first place; otherwise, the little interface routine has to get bigger, so that it can transform between the argument lists provided by the FORTRAN program and desired by the C routine.