The information on building a statically linked program is the same as for
dynamic linking (described above) with the following exceptions:
- Specify the -staticlink and -ml
options on the LF95 command line (do not specify -dll).
- Use ML_EXTERNAL instead of DLL_IMPORT
or DLL_EXPORT in your Fortran source match the calling
conventions of Visual C++ at compile time. If using Fujitsu C, calling conventions
can be matched by following the instructions in
- You must have a Fortran main program.
- Import libraries are not included on the LF95 command line (import libraries are
specific to DLLs).
- Fortran common blocks are aligned on one-byte boundaries. To align your C
structures along one-byte boundaries, use the /Zp1
option or the pack pragma with Microsoft Visual C++.
Use the -a- option or the option -a-
pragma with Borland C++. Note that use of these options should be limited to
files or sections of code that require one-byte alignment; one-byte alignment
can cause slower access to C structure members.
There are several examples in the following sections. The source code, to enable
you to experience mixed-language calling, are in subdirectories
ex2, ex3, etc., below the installation directory (by default <Program-Files>\Lahey-Fujitsu Fortran\<version>).
Each one is accompanied by a file called GEN.BAT, that will compile and link
the sample code. There are additional examples specific to compiler type in