CALLF - call Fortran 66 subprogram from B routine.

Alternate Entry Name: .CALLF

Usage:

B:
   callf( &fortname, &arg1, &arg2, ... )
C:
   TYPE callf(void *fortname, ...);
   /* TYPE should be set to type of value the  *
    * subprogram returns.                      */

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:

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

Note that CALLF must receive a pointer to the routine to be called (which is why the argument is written as "&fortname"). Similarly, CALLF 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 CALLF 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 the 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.

CALLF may be used with any Fortran 66 subroutine, or with a Fortran 66 function that returns a logical or integer value. The value of CALLF is the logical or integer value returned by "fortname", if any.

If "fortname" is a logical function, it returns zero if the result is false, and a non-zero value if the result is true.

For functions which return a floating point value, you must use the similar routine CALLFF when calling from B. Functions written in C, may use CALLF to call Fortran 66 functions which return a floating point value.

See Also:

expl b lib callff
for a similar routine to call Fortran floating point functions from B.
expl b lib callb
for a routine to call B from a Fortran routine.
expl b lib callc
for a routine to call C from a Fortran routine.

Copyright © 1996, Thinkage Ltd.