home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
f2cbin.zip
/
f2cbin
/
README.OS2
< prev
Wrap
Text File
|
1994-08-09
|
6KB
|
134 lines
Tue Aug 9 21:29:45 PDT 1994
========
OVERVIEW
========
Enclosed are OS/2 executables and support libraries for f2c, the
industrial strength, freely available, Fortran to C converter. The
source code for f2c is available via anonymous ftp from netlib.att.com,
or though the mail-server at netlib@research.att.com (send a message
with "help" as the subject to get started.) For more information on
the f2c copyright, see the enclosed copies of the "disclaimer" and
"permission" files from the original source distribution. The source
code used to build these OS/2 binaries, was obtained by ftp from
netlib.att.com and was current as of 94-07-28.
The enclosed f2c executable was compiled with Eberhard Mattes'
GCC/EMX compiler, release 0.8h (fix 5), so you need the emx run time
environment installed on your system to use it. The enclosed f2c
support library was also compiled with GCC/EMX, so if you intend to use
some other compiler to compile f2c converted C code, you will need to
get the source code for the f2c support library and compile it with
that particular compiler.
Here is a manifest of the files in this distribution;
documentation:
README.OS2 - the file you are now reading!
f2c.1 - nroff compatible man page
f2c.man - formatted man page
converter related files:
f2c.exe - f2c executable (requires emx 0.8h run time lib)
f2c.h - f2c header file for compiling f2c generated C code
f2ch.add - patch to f2c.h for use with C++ compilers
static link support libs:
f2c.a - static library for linking with EMX method 1 objects
f2c.lib - static library for linking with EMX method 2 objects
dynamic link support libs (EMX method 2 only):
f2clib.lib - static library for linking with f2c dll library
f2cdll.lib - import library for linking with f2c dll library
f2cdll.dll - f2c dll library
Note that there are several versions of the support libraries. There are
static libs for use with EMX method 1 and 2 objects (ie: .o and .obj
files). I've also included a dll version of the library for EMX method
2 objects (the EMX docs say that method 1 dll's are not recommended).
To link with the dynamic version of the library, there are actually
two libs that you must link with; f2clib and f2cdll. Most of the
library routines are in f2cdll. However, I had to move a few routines
into a small static library, that I called f2clib.lib. It contains
those routines that have external references that cannot be resolved by
linking to the EMX run time dlls. Specifically, the library startup
procedure (main), which calls *your* main program, and the Fortran
callable error functions (ie: y=erf(x) from Probability and Statistics)
which reference the corresponding functions from your system's libC.
GCC/EMX currently does *not* have these, so if you want to use the
Fortran callable stubs, you'll have to write your own C callable
versions of the functions, or find them somewhere. The dll library was
compiled with stack probes enabled (option -mprobe).
============
INSTALLATION
============
The installation of f2c can be done in two different ways. You
can install it in IBM's strange (IMHO) style of unpacking the works
into some directory, and then adding that directory to the following
environment variables in your config.sys file; PATH, LIBPATH, (and
assuming you are using GCC/EMX), C_INCLUDE_PATH, CPLUS_INCLUDE_PATH,
OBJC_INCLUDE_PATH, and LIBRARY_PATH.
Although it's purely just a question of style, I prefer to have
a set of directories specifically devoted to my own executables, include
files, libraries, and dlls (much like /usr/local/* on UNIX systems).
Just as an example, on my system I use; /os2/bin which is in PATH,
/os2/dll which is in LIBPATH, /os2/include which is in C_INCLUDE_PATH,
CPLUS_INCLUDE_PATH, and OBJC_INCLUDE_PATH, and /os2/lib which is in
LIBRARY_PATH. If you prefer this, move f2c.exe to your "bin" directory,
f2c.h to your "include" directory, the *.a and *.lib files to your "lib"
directory, and f2cdll.dll to your local "dll" directory. I strongly
recommend AGAINST using the emx/* directories since you could forget,
and trash the stuff the next time you upgrade GCC/EMX.
If you have GNU man installed on your system, move the nroff
man page, f2c.1 to your man/man1 directory. A pre-formatted version
of the man page, f2c.man, is included for those who don't have "man".
==============
HOW TO USE F2C
==============
OK, it's installed, "Now what?" you ask. There are three basic steps;
(1) run f2c to convert your Fortran code to C, (2) compile the C code
generated by f2c, and (3) link an executable from all your objects
together with the f2c support library. The only real "gotcha's" are gcc
not being able to find the "f2c.h" include file (all C code generated
by f2c #include's this file). If this is a problem verify that your
C_INCLUDE_PATH, CPLUS_INCLUDE_PATH, and OBJC_INCLUDE_PATH environment
variables are properly set, or use the -I option on the gcc command
line. Use "-lf2c" on the gcc command line to link with the static
version of the f2c library, and "-lf2clib -lf2cdll" to link with the
dynamic version (EMX method 2 only!). If gcc can't find the library(s),
be sure LIBRARY_PATH is properly set, or use the -L option.
The example sub-directory contains a sample Fortran program,
namely Jack Dongarra's LINPACK loops program (also obtained from
netlib) for *estimating* the floating point speed of your hardware /
software setup. You can do some example builds by just doing a "cd
example" and then type "demo" (a CMD.EXE script). [This assumes that
all the distribution files are still intact!!!]
After you get familiar with the process, you may want to try the
f77 command script that is available separately. It provides a command
line interface for compiling Fortran source code *directly* to object
code by running f2c and gcc for you. From the perspective of the
command line options and associated behavior of the script, it's almost
exactly like a "real" f77 compiler. It works fine, but be warned that
it requires having some other UNIX tools (the ksh or other bourne
"like" shell) installed on your system, so you might have to hunt
those down too.
Best Regards,
John C. Peterson
jcp%octagon.UUCP@ucsd.edu