Roadmap to the Visual Fortran Samples

The Visual Fortran kit provides a number of source code sample programs (samples) that cover a variety of topics. These samples are provided for illustration purposes only, although they can be freely used as a basis for other programs. You can copy the samples as needed. Use a text editor to view the samples; they are not listed as topics in HTML Help viewer.

On the Visual Fortran media CD-ROM, samples are located in folders under Info\Df\Samples. If you request that samples be installed using a Custom installation, the samples are by default installed in subdirectories under ...\Microsoft Visual Studio\Df98\Samples.

Visual Fortran samples include the following:

Advanced

Within the Advanced category, there are several other categories of samples. Each category is described below, and the specific samples within each are described in its section. Each category is contained within its own subdirectory of ...\Df98\Samples\Advanced:

Component Object Model (Advanced\Com)

The COM samples demonstrate use of the Component Object Model from within Visual Fortran:

Direct Fortran 90 Descriptor Manipulation (Advanced\Descript)

In other languages, such as C or Pascal, pointers are simple memory addresses with no notion of how the information is organized at the address pointed to. Fortran 90 pointers differ dramatically, by not just containing a memory address, but also keeping track of the bounds and strides of each dimension of an array. To accomplish this, the Fortran 90 compiler uses something called an Array Descriptor, which stores the details of how the array is organized. Array Descriptors may also be called Dope Vectors in other implementations.

By manipulating the contents of a descriptor directly, you can perform operations that would otherwise not be possible in strict Fortran 90. You can associate a Fortran 90 pointer with any piece of memory, organized in any way desired (so long as it is rectangular in terms of array bounds). You can also pass Fortran 90 pointers to other languages, such as C, and have the other language correctly interpolate the descriptor to obtain the information it needs. Important for mixed-language programming, you can create a Fortran 90 pointer associated with an array which is accessed in C's row order, rather than Fortran's traditional column order, allowing the same array to be used with the same subscripts from both C and Fortran.

The descript workspace has three subprojects. Each creates its own executable, and there are no dependencies between them:

OpenGL (Advanced\Opengl)

OpenGL is a protocol for performing advanced 3-dimensional graphics. Visual Fortran includes Fortran 90 modules and link libraries for using OpenGL from Fortran. The sample programs included in this section illustrate programs that take advantage of these facilities.

All OpenGL samples will run under Windows NT, Windows 2000, Windows Me, and Windows 98, but require the OSR2 release of Windows 95 to run there. Refer to our Frequently Asked Questions at http://www.compaq.com/fortran/visual/faq.html for more information.

Win32 API Calls (Advanced\Win32)

Visual Fortran includes Fortran 90 modules and libraries for doing Windows programming at the Win32 API level. For information on calling Win32 routines from a Fortran application, see Calling Win32 Routines. These samples presented here show Win32 API examples of how this is done:

Dialog Boxes (Dialog)

The Dialog samples demonstrate several of the newer dialog controls available through Visual Fortran. There is also a sample that demonstrates how to use modeless dialog boxes. The dialog samples can be found in the directory ...\Df98\Samples\Dialog:

DLL Examples (DLL)

Within Visual Fortran you can create and use dynamically linked libraries (DLLs). A DLL is loaded at run time by its calling modules (.EXE or .DLL). When a DLL is loaded, it is mapped into the address space of the calling process. There are generally two ways to bring in a DLL, either at image activation time or at run-time. If an image is linked against the import library for a DLL the code is mapped into the image's address space at image activation time. If the import library is not available, the DLL needs to be mapped in with Windows API calls.
The following DLL examples can be found in subdirectories under ...\Df98\Samples\DLL:

Exception Handling (ExceptionHandling)

Visual Fortran Version 6.5 introduces some routines to make it easier for the user to control floating-point exception handling:

ISO Varying Strings (Isovar)

The Isovar samples demonstrate one possible implementation for the interface to dynamic-length character strings in Fortran 95. The publicly accessible interface defined by this module is conformant with the auxiliary standard, ISO/IEC 1539-2: 1999. The Isovar samples are in separate directories under ...\Df98\Samples\Isovar and include:

Miscellaneous (Misc)

There are a number of miscellaneous samples that demonstrate some specific aspects of Visual Fortran or its utilities. The following miscellaneous examples can be found in separate subdirectories under ...\Df98\Samples\Misc:

Mixed-Language (Mixlang)

Visual Fortran can be called by a number of other languages, including Visual C/C++, Visual Basic, and MASM (Assembler). Also, it can call other languages, such as C/C++. The following samples in subdirectories under ...\Df98\Samples\Mixlang demonstrate some of the calling standards or argument definitions that must be used to effectively interwork with other languages:

QuickWin (Quickwin)

Visual Fortran provides a library of routines called QuickWin. QuickWin is a library that lets you build applications with a simplified version of the Windows interface with Visual Fortran. The QuickWin library provides a rich set of Windows features, but it does not include the complete Windows Applications Programming Interface (API). If you need additional capabilities, you must set up a Windows application to call the Win32 API directly rather than using QuickWin to build your program. The following samples demonstrate how to use QuickWin, and how to program around some of the strange paradigms of the package.
The following QuickWin examples can be found in subdirectories under ...\Df98\Samples\QuickWin:

Scientific Graphing Utility (SciGraph)

SCIGRAPH is a package of Fortran routines for drawing scientific graphs. Graph types available include line, bar, XY, and pie graphs. All graphs are fully customizable, including control over axis, log scales, data points, colors and shades, error bars, and many other aspects of a scientific graph. All graphs are drawn using Visual Fortran's QuickWin graphics routines, so they can be easily added to an already existing QuickWin application.
The SciGraph package can be found in ...\Df98\Samples\SciGraph:

Tutorial

All Tutorial samples are simple programs, and most of them are standalone. Each contains compilation information at the top of the file, both for command line and from within Developer Studio. If there are multiple files, this is noted at the top of the program. All tutorial samples can be found in the directory ...\Df98\Samples\Tutorial: