CALLFF - call Fortran 66 floating point function.

Usage:

callff(&fortname, &arg1, &arg2, ... )

Where:

&fortname
is a pointer to the beginning of the routine you want to call.
&arg1, &arg2, ...
are pointers to words in memory where the arguments for the Fortran routine are stored.

Description:

CALLFF will call the Fortran 66 routine "fortname" with arguments "arg1", "arg2", etc.

Note that CALLFF must receive a pointer to the routine to be called (which is why the argument is written as "&fortname"). Similarly, CALLFF must receive pointers to the arguments, not the arguments themselves. If you are passing a vector to "fortname", this means passing the vector pointer (which points to the vector itself). All other kinds of arguments should be passed by address. Thus to pass the variable "x" to "fortname", you would specify "&x".

Since B will not accept a construction of the form "&<expression>", you must store any expressions you wish to pass in temporary storage locations and then pass the address of these temporaries.

Fortran routines called with CALLFF may not do binary or random I/O. (See "expl b fortran" for details.)

Since the Fortran routine receives pointers to the memory locations where its arguments are stored, the routine may change the values of its arguments as it executes. This differs from function calls in B where all arguments are passed by value, and hence are not affected by the operations of the function being called.

CALLFF may be used with any Fortran 66 subroutine, or with any Fortran 66 function that returns a floating point value. Fortran floating point functions always return a double precision number; CALLFF always rounds and converts this to single precision. The value of CALLFF is the floating point value returned, if any.

For functions which return a logical or integer value, you must use the similar routine CALLF.

Because of the conversion described above, C functions should NOT use CALLFF to call Fortran routines that return floating values. They should use CALLF instead, with an appropriate type declaration.

See Also:

expl b lib callf

Copyright © 1996, Thinkage Ltd.