Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!hplabs!hpfcso!bigelow From: bigelow@hpfcso.FC.HP.COM (Jim Bigelow) Newsgroups: comp.lang.pascal Subject: Re: Fortran routines from pascal? Message-ID: <9110024@hpfcso.FC.HP.COM> Date: 12 Mar 91 22:38:47 GMT References: <1991Mar7.111905.10406@vaxa.strath.ac.uk> Organization: Hewlett-Packard, Fort Collins, CO, USA Lines: 102 > This is on an HP 9000 series 300 workstation running HP-Ux 7.0 > if that helps. It does. > ... Does anyone know how to go > about calling a Fortran routine from Pascal? 1) You must provide an external declaration for the fortran routines. If the external name is the same as the one you're going to use in the Pascal code, nothing more need be done. If the name is different you must use the $alias directive (be sure to add the the leading '_'). For example, procedure fortran_sub; external; procedure fortran_routine $alias '_real_name'$; external; 2) Pascal to Fortran Inter-language Compatibility Pascal Fortran boolean logical*1 logical*2 logical*4 -- won't work char character*1 integer integer (*4) -32768..32767 integer (*2) real real (*4) longreal double precision enumberated use integer*2 type subrange use integer*4 (32-bit) subrange use integer*2 (16-bit) set none record record pointer none var^ none 2) calling FORTRAN Arrays pascal stores in row-major, FORTRAN in column-major Files A FORTRAN unita can not be passed to a Pascal routine to perfrom I/O. Conversly, Pascal files can not be passed to FORTRAN. Parameter Passing FORTRAN passes by reference, therefore all pascal paramters must be var. Complex numbers Pascal must define a type complex: type complex : record real_part, imaginary_part : real; end; FORTRAN complex*16 not supported in pascal Fortran Hollerith and Character: Equivalent to Pascal packed array of char Pascal procedure parameters Fortran must allow for the static link associated with all pascal functions when accepting a pascal function as a parameter. Please write for more information/claraification (jim@hpfcrt.hp.com) or refer to the follwoing manuals: "HP-UX Paortability Guide" B1864-90006 "HP-UX Assembler and Tools" B1699-90000 "HP Pascal Language Reference" B1689-90600 Best Regards, Jim Bigelow HP Pascal HP9000 S300/S400 Colorado language Lab. Hewlett Packard MS 96 3404 East Harmony Road Ft. Collins, CO 80525 USA