# Fortran question (beginner)

1. Oct 28, 2015

### faeriewhisper

Hello!
I'm trying to use a subprogram from the Starlink Project - Lucy in the library KAPPA - that is already installed and compiled. The idea is to be able to call it from my fortran routine.

Something like this:
Code (Text):
PROGRAM ex

INTEGER i
REAL in(10),psf(10),out(10)

DO i =1,10
in(i) = rand()
psf(i) = rand()
ENDDO

lucy in psf out

WRITE(*,*)out

END
Is that possible?
If so, how should I compile the file (using gfortran)?

$export STARLINK_DIR=$HOME/Astronomy/Software/star-2015A
$source$STARLINK_DIR/etc/profile

After that you can run the subprograms by typing:
$kappa$ lucy

The compiled lucy file can be found here: \$HOME/Astronomy/Software/star-2015A/bin/kappa/lucy

2. Oct 28, 2015

### Staff: Mentor

You would have to use
Code (Fortran):

call lucy (status)

But the subroutine lucy doesn't take in any other argument than that status, so I don't see how you can pass data to and from your own program.

After a quick look at the source code, it doesn't appear that the subroutine was intended to be used on its own. I think it would take quite some work to disentangle it from the main program.