Command Line Arguments

Up: Contents Next: Examples Previous: Indicating Include Files

To use bfort, you need only to give it the name of the files to process. For example, to process every .c and .h file in the current directory, use

bfort *.[ch] 
Command-line options to bfort allow you to change the details of how bfort generates output.

A complete list of the command line options follows. Some of these will be used often (e.g., -anyname); others are needed only in special cases (e.g., -ferr).

The following option controls the location of the output file:

-dir name
Directory for output file

In all cases, the name of the output file is the name of the input file with an f suffix. For example, if the input file is foo.c, the file containing the generated wrappers is foof.c.

The following options control the kind of messages that bfort produces about the generated interfaces.

Do not generate messages for routines that cannot be converted to Fortran.
Generate messages for all routines/macros without a Fortran counterpart.

The following options provide special control over the form of the interface and the generated file.
Generate a single wrapper that can handle the three most common cases: trailing underscore, no underscore, and all caps. The choice is based on whether one of the following macro names is defined.
Names are upper case with no trailing underscore.
Names are lower case with trailing underscore.
Names are lower case, with two trailing underscores. This is needed when some versions of f2c are used to generate C for Fortran routines. Note that f2c uses two underscores only when the name already contains an underscore (on at least one FreeBSD system that uses f2c). To handle this case, the generated code contains the second underscore only when the name already contains one.

In addition, if -mpi is used, the MPI profiling names are also generated, surrounded by MPI_BUILD_PROFILING.

Fortran versions return the value of the routine as the last argument (an integer). This is used in MPI and is a common approach for handling error returns.

-I name
Give the name of a file that contains #include statements that are necessary to compile the wrapper.

Generate special code to convert Fortran integers to and from pointers used by the C routines. The special code is used only if the macro POINTER_64_BITS is defined. It is also used to determine whether pointers are too long to fit in a 32-bit Fortran integer. (You have to insert a call to __RmPointer( pointer ) into the routines that destroy the pointer.) The routines for managing the pointers are in ptrcvt.c.

Multiple indirects (int *** are native datatypes; that is, there is no coercion to the basic type).

Recognize special MPI [(ref mpi-final)] datatypes (some MPI datatypes are pointers by definition).

-ptrprefix name
Change the prefix for names of functions to convert to/from pointers. The default value of name is __.

Consider void * as a pointer to a structure.

Generate ANSI-C style headers instead of Fortran interfaces. This is useful in creating ANSI prototypes without converting the code to ANSI prototype form. These use a trick to provide both ANSI and non-ANSI prototypes. The declarations are wrapped in ANSI_ARGS, the definition of which should be
#ifdef ANSI_ARG 
#undef ANSI_ARG 
#ifdef __STDC__ 
#define ANSI_ARGS(a) a 
#define ANSI_ARGS(a) () 

After the command-line arguments come the names of the files for which Fortran interfaces are to be constructed.

Up: Contents Next: Examples Previous: Indicating Include Files