Newsgroups: comp.parallel.pvm
From: overeind@fwi.uva.nl (Benno J. Overeinder)
Subject: Re: Pvmfspawn doesn't work under LINUX
Organization: FWI, University of Amsterdam
Date: 10 Nov 1994 11:15:42 +0100
Message-ID: <39srse$16u@word.fwi.uva.nl>

packer@fermi.gsfc.nasa.gov (Charles Packer) writes:

>In article <39qpvg$5lq@paperboy.gsfc.nasa.gov>,
>Charles Packer <packer@fermi.gsfc.nasa.gov> wrote:
>>The f77 "compiler" is actually f2c followed by cc. Inspection of
>>the output of f2c reveals that "call pvmfspawn" is converted
>>to something called "pvmfspawn_", which, presumably, calls


>...and it was pointed out to me very gently that since it's not
>a Fortran intrinsic routine, I have to =write= pvmfspawn_
>myself :-)

>So I now have a C routine cspawn_ which I call with a 
>"call cspawn" in my Fortran program. Here it is for 
>anybody who has no real Fortran compiler...

I think the problem with the f2c compiler is more fundamental.

First, you don't have to write pvmfspawn_ by yourself.  It is generated
from the m4 file.  But that is at the same time the problem ;-)

The LINUX.m4 inputfile describes the way how, amongst others, strings
should be handled in from FORTRAN to C function calls.  Currently, 
the m4 macros translates a FORTRAN string to a char pointer in C plus 
a integer pointer which denotes the length of the string buffer.
(Please correct me, because I recollect it by heart.)  The f2c 
compiler however, translates a FORTRAN function call with strings as 
parameters to a  character pointer, and an integer (thus not a pointer).
Next the positions of the parameters are not compatible.  The m4 macros
put the character pointer an integer pointer together, f2c leaves the
parameters in the same order, and puts the integer associated with a string
at the end of the parameter list.

Anyhow, the result in the pvmfspawn is that a string with incorrect lenght
is copied and strncpy generates an error.  (Segmentation volation?, I cann't
remember)


So, probably the only correct way to handle this problem is to
rewrite the LINUX.m4  for the f2c compiler.

Comments?


Benno
-- 
 Benno Overeinder			 Computer Systems Department	     
 voice: (+31) 20 525 7536		 University of Amsterdam	    
 fax:   (+31) 20 525 7490		 Kruislaan 403, 1098 SJ  Amsterdam
 e-mail: overeind@fwi.uva.nl		 The Netherlands

