38
jplint, in turn, calls JPL subroutine pleph (Fortran code). The C function solarsystem has
a few features that make it possible for it to exchange data with the Fortran subroutine
jplint. First, all of the C arguments of the call to jplint are addresses, since Fortran uses
call by address instead of call by value for arguments of subroutines. Second, all of the
integer arguments in the call are designated as type
long int
in the C function to
match the Fortran
INTEGER
default. The
DOUBLE PRECISION
arguments in the
subroutine are designated as type
double
in the C function.
Probably the biggest hurdle in implementing version 2 of solarsystem will involve the
proper compiling and linking of the mixed-language files. The procedures will be
specific to your computing platform; therefore, you will have to consult your compiler
manual for detailed instructions. The following instructions are offered only as a
guideline they provide a specific example of how the mixed-language files were
successfully handled on an IBM RISC System 6000 Unix workstation.
1. Create a single file with all of the JPL Fortran ephemeris access subroutines.
Name it jplsubs.f.
2. Compile the Fortran files without invoking the linkage editor. This creates the
object file jplsubs.o and jplint.o. The Fortran compiler/linker is
xlf
.
xlf -c jplsubs.f jplint.f
3. Compile, again without invoking the linkage editor, the C files novas.c,
novascon.c, solsys2.c, and readeph0.c. This creates the object files novas.o,
novascon.o, solsys2.o, and readeph0.o:
xlc -c -lm novas.c novascon.c solsys2.c readeph0.c
The C compiler/linker is
xlc
. The
-lm
option specifically searches the math library.
4. Finally, compile the main function and link it with the object files:
In this example, the resulting executable file is named app. Note especially the use of the
-l
option to force the C compiler/linker to search the Fortran libraries for unresolved
references.
create executable named "app"
search the C math library
search the Fortran
libraries (xlf90)
main function
object files
search in this directory
for -l libraries
xlc -L/usr/lib -lm -lxlf90 -o app main.c novas.o novascon.o solsys2.o readeph0.o jplsubs.o