Xref: utzoo comp.lang.c:39381 comp.lang.fortran:5422 comp.unix.questions:31485 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!spool.mu.edu!rex!ames!dftsrv!amarna.gsfc.nasa.gov!packer From: packer@amarna.gsfc.nasa.gov (Charles Packer) Newsgroups: comp.lang.c,comp.lang.fortran,comp.unix.questions Subject: Re: Calling C from FORTRAN under Unix Message-ID: <5360@dftsrv.gsfc.nasa.gov> Date: 20 May 91 14:31:57 GMT Article-I.D.: dftsrv.5360 References: <5343@dftsrv.gsfc.nasa.gov> <1991May17.163421.11604@unixg.ubc.ca> Sender: news@dftsrv.gsfc.nasa.gov Reply-To: packer@amarna.gsfc.nasa.gov Organization: Dept. of Independence Lines: 51 News-Software: VAX/VMS VNEWS 1.3-4 I received 15 e-mail replies to my query, (two since I started writing this followup) -- thanks to everyone! Almost all of them, with varying degrees of certainty, suggested appending an underscore to the subroutine name in the C source module and compiling and linking as usual. This included one reply from an Ultrix 4.1 user. But we have Ultrix 4.0, (on a VAXStation) and buried in its manual is material that tells how to call C from FORTRAN. It requires an intermediate language they call "JBL." Underscores are irrelevant. To prove that I'm not making this up, below is an excerpt from the source I used to test the scheme by filling an image array in Fortran and passing it to C, which in turn called a display routine. FORTRAN------------------------------ BYTE IMGDAT(0:511,0:511) . . . CALL LTEST(IMGDAT,J) JBL (in it's entirety)------ LTEST(ref:ref,ref:val); C----------------------------------- void ltest_(Img,InVal) unsigned char Img[512][512]; int InVal; { . . . THE BUILD COMMAND-------------------- fort aa.for c.jbl csubr.c [OR, if modules compiled separately,] fort aa.o c.jbl csubr.o