PDA

View Full Version : SPACE_LIB, FORTRAN and Pascal



Giovanni Legnani. University Of Brescia - Italy - Europeancommunity
02-21-1991, 06:08 PM
Dear SPACE_LIB users,

I was requested by a few of you to point out the
possibility of using SPACE_LIB (written in the C-language) with
FORTRAN or Pascal programs. This possibility certainly exists!

However the details for writing mixed language programs depends on the
operative system used. I have experience in MS-DOS, VAX-VMS and a
little in UNIX. Little problems can arise with the name of the
functions/procedures (name length, special characters, upper/lowercase
character) and the functions parameters conventions (by reference or
by value). Information must be collected from the language manuals.

Programmers are sometimes requested to add to the calling program a
special statement which informs the compiler that the called routine
is written in another language (e.g. in FORTRAN MS-DOS programs you
must use the INTERFACE statement) or in FORTRAN VAX-VMS you may need
to use some "pseudo-functions" like %ref() or %val() to force the
compiler to use a particular calling convention. Occasionally you
have to write simple functions to convert the type of a few variables.
Sometimes you could have a little problem when using DOUBLE-PRECISION
if you wish to pass the parameters by value.
In UNIX there are also fewer problems because the operative systems is
written in C-language itself. So any C-procedure can be easily called
by any language.

However I have already written mixed language programs without finding
big problems. For instance the program for whole-body simulation is
written in C language, but the graphics routines are partially written
in Fortran. This program runs either on VAX-VMS and MS-DOS machines. A
student of mine uses SPACE_LIB on a VAX-VMS computer calling the
library function from a Pascal program. I have cooperated in writing
large simulation programs written partially in FORTRAN and C-language
for UNIX machines.


Summarizing: no problem with mixed language programming for SPACE_LIB
users! For details, please contact your local expert and the manual of
YOUR system.

I would be happy to supply more detailed information about practical
problems relative to SPACE_LIB.

bye
Giovanni LEGNANI.