HP OpenVMS Systems

ask the wizard
Content starts here

Mixed Fortran and C, FTP, and system/lib$spawn?

» close window

The Question is:

 
Hello
I want to use FTP from a program, so I built a Fortran program that calls a
C-subroutine that uses SYSTEM-call to run a .com file that does the job.
This does not work, but if I make a program of the C-subroutine and run i,
all is well.
Why?
 
 


The Answer is :

 
  "Does not work" is a classic though rather inexact description of a
  program, the particular problem(s), and/or the error message(s) that
  might have resulted...  The OpenVMS Wizard will thus (have to) guess...
 
  In this case, the OpenVMS Wizard would suggest using lib$spawn directly
  from Fortran, not a call to a C routine.
 
  C has a run-time environment initialization step required when C
  subroutines are used when a C main is not present -- if you choose
  to continue the current approach, remember to call VAXC$CRTL_INIT
  to initialize the C run-time library at the appropriate point...
 
  C also has differing string expectations than Fortran, and this problem
  could simply be case of an argument-passing error -- compatible passing
  is available and mixed-language calling is supported, but the string
  argument passing defaults do differ between these two languages...
 
  As for the command used, COPY/FTP is also a typical approach for the
  desired operation.  This (V6.2 and later) syntax permits the use of
  a single command for the FTP operation...
 
  Also be aware that system and lib$spawn do not operate when there is
  no CLI environment present -- the oft-discussed SS$_NOCLI error will
  arise when a CLI (such as DCL) is not available and a CLI callback
  (such as lib$spawn or system) is made...  (See the SS$_NOCLI details
  in the FAQ for a related discussion.)
 

answer written or last revised on ( 1-DEC-1999 )

» close window