Summary: Use calls to Windows API I/O functions to avoid 2 problems: Fortran DLLs cannot read or write to binary or unformatted files Files opened in a DLL called from VB 2.0 may not close consistently This file contains: fortio.def Example module definitions file fortio.for Example Fortran DLL file fortio.mak Make file for example huge.def Module definitions file for hread and hwrite API legal.txt readme.txt This file test.for Test program to use fortio.dll dll-io.zip Zip file containing all the other files More Information: The following Fortran code 'fortio.for' demonstrates how to access files using the Windows API for file I/O. Binary Data I/O: The example below defines 'bfread' and 'bfwrite' to use a REAL*4 data buffer (in the interfaces to the Windows API functions '_hread' and '_hwrite'). Additional interfaces could be used to define function names which use buffers of different data types (compare the interface statements for 'bfread' and 'hread', and read the comments in FORTIO.FOR). File I/O in a DLL called from Visual Basic 2.0 or later: A file which is opened and closed with standard Fortran I/O statements may not be accessable by anything until the VB application exits. A file which is opened/created, accessed, and closed using the Windows API I/O functions can be read or written by VB or any other application as soon as it is closed. This example contains interfaces to '_hread' and '_hwrite' rather than '_lread' and '_lwrite' (which can only access data items less than 64K, but may be slightly more efficient for small data items). The library 'huge.lib' created from 'huge.def' is required to reference the huge version of 'read' and 'write' defined in version 3.1 of the Windows API. Only references to Windows 3.0 functions are provided in LDLLFEW. The Windows API functions return -1 if an error occurs. To run the example: type nmake -f fortio.mak at the dos prompt, and then run 'test.exe' from File Manager in Windows. NOTE: The following line in 'FORTIO.MAK' may need to be modified to reflect the actual path-name for 'FL.DEF'. link /NOD test.obj,,nul,llibfew+fortio.lib,c:\fortran\binb\fl.def; This assumes the default directory name for the 'FL.DEF' file. If 'FL.DEF' is not in 'c:\fortran\binb', the following error will occur: LINK : fatal error L1092: cannot open module-definition file For additional information on the Windows API functions, look in any reference manual of Windows Functions (such as the Windows SDK Programmer's Reference Volume 2: Functions).