Sei sulla pagina 1di 193

Introducing

Compaq Visual Fortran

www.compaq.com
Compaq Visual Fortran
®

 Offers a combination of:


 The robustness and reliability of Compaq’s Fortran
95 compiler
®

The easy-to-use Microsoft visual development
environment
Compaq Visual Fortran
 32-bit Development System for x86 (Intel® , AMD®,
…) PCs running:

Windows® 2000
 Windows NT® 4
 Windows 98
 Windows 95
Compaq Visual Fortran
 The Compaq Fortran Compiler
 Full support of the Fortran 95 Standard*

Compaq Fortran (formerly DIGITAL® Fortran) and
Microsoft Fortran language extensions for easy
code portability among platforms

* Previous standards (Fortran 90, FORTRAN 77, FORTRAN IV) are also supported
Compaq Visual Fortran
 Offers Portability from other Platforms
 Microsoft-recommended upgrade for PowerStation
4.0 users

Provides a consistent Fortran language dialect
from desktop to mainframe-class systems
 Compatible with Fortran code written for other

Compaq Fortran platforms:


– Compaq Tru64 UNIX® Alpha
TM

– Linux® Alpha
– OpenVMS Alpha
TM
Compaq Visual Fortran
 Microsoft visual development environment
 Windows-based application development

Visual editor with color coded syntax highlighting
 Visual debugger

 Context-sensitive online documentation

 Same development environment used by Microsoft

Visual C++® V6
Compaq Visual Fortran
 Visual development tools
 Debugger

Source Code Browser
 Windows resource editor
 Fortran Module Wizard for working with COM Objects

Fortran COM Server Wizard for creating COM
servers (Professional and Enterprise Editions)
 Graphical viewer for visualizing multi-dimensional
arrays (Professional and Enterprise Editions)
About this demo...
 This presentation was created using Microsoft
PowerPoint® 97

To perform the next event
(such as show a line of text or go to the next slide)
– Press the Page-Down key
– Or press the right arrow key
About this demo...
 Slowing down the demo
 To pause the demo
– Click the right mouse button
– This menu will appear

The demo is paused while


this menu is displayed
About this demo...

Choosing ‘Advance’ performs


the next slide action

‘Reverse’ displays the


last slide you viewed

Choosing ‘End Show’


will end the demo
Project-based Development
 Visual Fortran organizes application source files
by grouping code, libraries, and windows
resources together in one entity: the project
 Facilitates Windows and Mixed-Language
programming
Visual Fortran Can Build
Several Kinds of Projects

To create a new project, click New


from the File menu.

The following screen appears,


displaying available project types.
A Fortran Console application is a
traditional text-oriented interface
that can use most Win32® APIs
Visual Fortran Can Build
Several Kinds of Projects

Fortran Windows Applications are


GUI applications with full access
to the Win32 APIs
Visual Fortran Can Build
Several Kinds of Projects

The QuickWin environment


provides an easy way to give
existing Fortran applications a
Windows “look and feel”
Visual Fortran Can Build
Several Kinds of Projects

If you have the Microsoft Visual C++ or


the Visual Fortran Professional or
Enterprise Editions installed, additional
project types will be listed (not shown on
this screen).

You can also develop Fortran


static and dynamic link
libraries
Fortran COM Server

With the Professional or Enterprise


Editions, you can develop
Fortran-based COM Servers
Compaq Visual Fortran
 Visual Fortran is available for x86 PC systems running
Windows NT, Windows 2000, Windows 98, and Windows
95 operating systems. Visual Fortran uses the same
development environment on all operating systems:
– Compiler
– Debugger
– Source Code Browser
– Fortran Module Wizard
– Fortran COM Server Wizard
– Array Visualizer
– Online Documentation
Version 6.5 New Features
 New Features for Version 6.5:
 Architecture-specific support for Pentium III, AMD K6, AMD
K6-2/K6-III, and AMD Athlon processors
 Fortran COM Server project type and Fortran COM Server
Wizard (in Professional and Enterprise Editions) simplify
creating Fortran-based COM servers. You can create in-
process servers that use custom or dual interfaces

New COM routines COMStringFromGUID and
COMIsEqualGUID

New and changed intrinsics:
– INT_PTR_KIND returns the KIND for an integer that is large enough
to hold an address
– POPCNT, POPPAR, LEADZ, and TRAILZ
– Optional KIND argument to LEN, SHAPE, SIZE, LBOUND, and
UBOUND
Version 6.5 New Features
 New exception handling routines CLEARSTATUSFPQQ and
GETEXCEPTIONPTRSQQ (x86 systems)
 New environment variable FORT_CONVERT_ext for
unformatted non-native files
 Support added to read nondelimited character strings as
input for character NAMELIST items
 DLLEXPORT and DLLIMPORT of variables now allow
export/import of module variables and arrays.

Concurrent-use licensing is now available

Many new sample programs

Faster processing of modules at compile time
New Features in Version 6
 In addition to v6.5 new features, earlier Visual
Fortran V6 releases included hundreds of new
and improved features, which include:
 Full Fortran 95 Standard support.
 Optional diagnostics flag features deemed

"obsolescent" or "deleted" (such features are still


supported by the compiler).
New Features in Version 6
 New optimization features can significantly improve
application performance over V5, including
architecture-specific optimizations.
 Full traceback reporting on severe errors with file

names, routine names, and line numbers.


 Dialog support now includes modeless dialogs and

additional controls, including ActiveX® controls,


progress, tab, and spin controls.
 Microsoft's newest visual development environment,

featuring seamless integration with Microsoft Visual


C++ V6, makes it easy to develop and debug mixed-
language applications.
New Features in Version 6
 New Fortran application wizards help you get started
on new projects.
 You can save Fortran project settings for later use

when creating new projects of the same project type.


 Compaq Extended Math Library (CXML) is now

provided, including over 1500 mathematical routines.


 Compaq Array Visualizer (in Professional and

Enterprise Editions only) provides an interactive


graphic view of your application's array data.
New Features in Version 6

Traceback Reporting
 When a Fortran program terminates due to a severe
error condition, the Fortran run-time system displays
a report of the calling sequence leading to the error.
This tabular report contains one line per call stack
frame and includes at least the image name and a
hexadecimal program counter (PC) in that image.
New Features in Version 6

Traceback Reporting
 When you request traceback information during
compilation, the report contains program counter to
source file line correlation information in the displayed
error message report. The file names, routine names,
and line numbers simplify the task of locating the
cause of severe run-time errors.
New Features in Version 6
A traceback report might appear as follows:

The stack frame of real interest is the first frame in


image teof.exe, which shows that the error originated
in the routine named AGAIN in source module
teof.for at line 21
Compaq Extended Math Library (CXML)
 Compaq Extended Math Library (CXML) provides:
 Basic Linear Algebra Subprograms (BLAS) library
– Industry-standard Basic Linear Algebra Subprograms, including
Level 1 (vector-vector, BLAS1), Level 2 (matrix-vector, BLAS2),
and Level 3 (matrix-matrix, BLAS3), BLAS Level 1 Extensions,
and Sparse BLAS Level 1.

Signal Processing library
– Provides a basic set of signal processing functions, including
one-, two-, and three-dimensional Fast Fourier Transforms
(FFT), group FFTs, Cosine/Sine Transforms (FCT/FST),
Convolution, Correlation, and Digital Filters.

Sparse Linear System library
– Provides both direct and iterative sparse linear system solvers.
The direct solver package supports both symmetric and
nonsymmetric sparse matrices stored using the skyline storage
scheme. The iterative solver package contains a basic set of
storage schemes, preconditioners, and iterative solvers.
Compaq Extended Math Library (CXML)
 LAPACK subprograms
– Industry-standard subprogram package offering an extensive set
of linear system and eigenproblem solvers. LAPACK uses
blocked algorithms that are better suited to most modern
architectures.

Utility subprograms
– Provides random number generation, vector math functions, and
sorting subprograms.
 CXML is also available for other Compaq Fortran Alpha
platforms (see http://www.compaq.com/math)
 To call CXML routines from Visual Fortran, add the following
INCLUDE statement:
INCLUDE 'CXML_INCLUDE.F90’
Main Menu
I would like to…
 Learn more about the Microsoft visual
development environment
 Learn more about mixed language programming
and dynamic link libraries
 Learn more about using COM objects with Visual
Fortran
 Learn about Visual Fortran Professional Edition
 Learn about the Compaq Array Visualizer
 End the presentation
Building a Project: qwpaint
 We will now use Compaq Visual Fortran to build
a Fortran QuickWin application named qwpaint
 This sample application draws simple colored

shapes with the mouse


 Along the way we’ll be using the Debugger and

Browser to help us fix a problem in our program

Back to Main Menu


Welcome to the visual development
environment!
The visual development environment allows you to compile
and run your Fortran application with a click of a button

Before we begin, we will customize the visual


development environment’s appearance
to suit our needs

Back to Main Menu


The toolbars can be repositioned
within the visual development environment

Back to Main Menu


Other useful windows can
be displayed as well

Back to Main Menu


The Output window displays
compile and link errors as
well as debugging information

Back to Main Menu


Choose the File | New... menu
item to create a new Project

Back to Main Menu


The “New” dialog box...
Don’t forget to name
your project

Choose Fortran QuickWin


Application as the kind of
project to build You can specify in
which directory it is
placed (or accept the
default location)

Back to Main Menu


In our application, we’ll use
multiple windows

Select the Windows interface best suited to your application

Back to Main Menu


Now we will add some
files to the project

The qwpaint project


has been opened.

Back to Main Menu


Insert Files into a Project...

Use this dialog box to select


the source files for the project.

Back to Main Menu


As a default, the editor highlights
Fortran keywords in blue
and comments in green

The files are listed under Source


Files in the Project Window.

To edit a file, double-click its name.

Back to Main Menu


After adding files to a
project, select each new
file in the FileView pane Clicking the build button
and select Compile from or choosing
the Build menu. Build | Build qwpaint.exe will
compile and link this project

Information about the build


will be displayed here

Back to Main Menu


The qwpaint Project It looks like we
requires qwpaint.mod have a syntax error.

Back to Main Menu


Double clicking on the error
message or pressing F4 brings
the editor to the erroneous line

Back to Main Menu


Now that the problem has
been fixed, rebuild the project

Back to Main Menu


Let’s run the application

Oh good, everything built

Back to Main Menu


This is what our
application looks like

The mouse draws


shapes in this window

Over here, you can


adjust the shape
and its color

Back to Main Menu


It looks like we have a bug This area should
in our program! have 16 different
colored squares.

Like this!

Back to Main Menu


Now we need to debug our program.

The visual development environment


makes this easy, though.

Back to Main Menu


But where do we begin?

From this comment, we can guess


that the bug occurs in the
subroutine DrawControlGrid()

Back to Main Menu


We’d like to locate
DrawControlGrid()
in the code.

We could do a text search


for DrawControlGrid()...

…but that would be slow and


could become complicated
if we had to search through
a number of files.

Back to Main Menu


We can use the “Find in Files”
tool to search a number
of files for a certain string

Back to Main Menu


“Find in Files…”

The text to search for...

…where to look for the files

Back to Main Menu


Results of the search are
displayed in this window

Back to Main Menu


“Find in Files” finds all occurrences of a
given string, but we’d like to know more.

Specifically, we’d like to know where


DrawControlGrid() is defined.

Back to Main Menu


For this task we can use
Visual Fortran’s
Source Code Browser

Back to Main Menu


To use the source code browser,
we need to adjust the project settings

Back to Main Menu


The “Project Settings” dialog box...

Settings must be changed


under the “Fortran” and
“Browse Info” tabs

Back to Main Menu


The “Project Settings” dialog box...

The project settings


dialog box also allows
you to generate listing
and assembly files.

Back to Main Menu


Rebuild your project to
generate browser
information
…then in the Tools
menu choose Source
Browser to start
browsing

Back to Main Menu


You can browse This is the main
information Browser dialog box
about any identifier
in your source
code. We want to
know about
DrawControlGrid

You can get


information
about variable
declaration and
usage, call Since the Fortran language is
structure, and file not case-sensitive, be sure to
hierarchy. uncheck the “case-sensitive”
check box!
Back to Main Menu
Clicking “OK” brings up this box

This window lists all of the Double-click on any of these


places in your code in which entries to go to that line
DrawControlGrid() occurs of source code

Back to Main Menu


We want to know where
DrawControlGrid is defined.

Double-click on the definition...

Back to Main Menu


…and the Browser takes you
right to the code

Back to Main Menu


If we look at the code for
DrawControlGrid(), we see
that the grid is drawn here

The function setcolor is called


to change the color

Back to Main Menu


We’d like to know more about
the setcolor QuickWin function.

We can use the HTML Help Viewer


online documentation to get information
about setcolor.

Back to Main Menu


Click the word we’d like
to know more about...

and press the F1


key to search
the online help.

Back to Main Menu


This dialog box searches
the online help.
Click Display to view
the help page

Back to Main Menu


A new window opens to allow you to view
the online documentation.

Information about function


parameters and return values.

Description of usage
and functionality available in
“Remarks”

Back to Main Menu


Links to other online
documentation

Many help topics come


with example code

Back to Main Menu


You can browse the online help
by clicking on the various topics

Back
Backto to
Main Menu
Main Menu
We think that the bug occurs
somewhere in this code

Let’s use the Visual Fortran


debugger to see what
happens during execution

Back to Main Menu


Click the hand to
Click this button set a breakpoint
to start debugging at the current
cursor position

Back to Main Menu


This arrow points to the
next line to be executed

The visual development environment


has changed into debugging mode

Back to Main Menu


This window allows you to view
the values of local variables.
Over here, you can watch the
value of a certain variable.

Records and arrays can


be viewed in their entirety
with just the click of a button

Back to Main Menu


You can step through the
program by clicking this icon

Variable values are


updated automatically

Back to Main Menu


After some more debugging, we find
the answer to our problem.

By examining the values of i, j, and i2,


we determine that the argument to
setcolor should be i*4+j not i*4+i

Back to Main Menu


…we can ..and rebuild
stop
debugging...

Now that we have changed


our source code...

Back to Main Menu


No errors! Let’s run our application

Back to Main Menu


Our problem
has been fixed

Back to Main Menu


Building a Project: qwpaint
 We used Visual Fortran to build an application
that used the QuickWin graphics libraries
 The source files were organized using a project

 We used the context-sensitive feature of the

online documentation
 The Browser and Debugger helped us fix a

couple of problems with our program

Back to Main Menu


Main Menu

I would like to…


 Learn more about the Microsoft visual
development environment
 Learn more about mixed language programming
and dynamic link libraries
 Learn more about using COM objects with Visual
Fortran
 Learn about Visual Fortran Professional Edition
 Learn about the Compaq Array Visualizer
 End the presentation
Building a DLL
 Functions in dynamic-link libraries (DLLs) are not
loaded until they are called at run-time
 Using DLLs reduces the size of executables and

modularizes source code

Back to Main Menu


Building a DLL
 We will now use Visual Fortran to construct a
DLL
 The DLL will be written using fixed-source form

syntax, but its functions will be called in programs


written in Fortran 95 and C++
 Even though Microsoft Visual C++ 6 is purchased

separately from Visual Fortran, both products


share the same development environment!

Back to Main Menu


Building a DLL
 Our application will be called spline because our
DLL contains functions that perform a spline
analysis on data
 spline also introduces the concept of visual

development environment workspaces.


Workspaces allow several projects to be grouped
together.

Back to Main Menu


Building a DLL
 spline demonstrates mixed language
programming using Visual Fortran and Visual
C++
 Installing Visual C++ adds options to the visual
development environment that are not applicable to
Visual Fortran
– Different kinds of Projects to build
– C++ tools

Back to Main Menu


Building a DLL
 The spline Workspace consists of three Projects:
 splinedll - a DLL containing routines that perform a
spline analysis on data

splineqw - a Visual Fortran QuickWin application
that calls routines in splinedll.dll
 splinevc - a Visual C++ program that uses the

routines in splinedll.dll

Back to Main Menu


To create a new workspace,
choose File | New...

Back to Main Menu


We’ll create a Fortran Dynamic
Link Library project...
…called splinedll...

…and simultaneously create a


workspace for our project

Back to Main Menu


Choose “an empty DLL
application” in the app-wizard
dialogue...

…and click “Finish”...

Back to Main Menu


The App Wizard
creates an empty
workspace for our
project.

Let’s add some files to the


splinedll project
Back to Main Menu
Insert the spline.for file
into the splinedll project

Back to Main Menu


The visual development
environment editor formats
itself for editing fixed-form
Fortran source code

spline.for contains two functions,


SplineCalculate() and SplineEvaluate(),
which determine the spline curve
Back to Main Menu
Build the DLL just like
you would any other
project

Back to Main Menu


Now we’re going to build splineqw,
a Fortran QuickWin program
that uses splinedll.dll

--------------------Configuration: spldll - Win32 Debug--------------------


spline.dll - 0 error(s), 0 warning(s)

Back to Main Menu


We’ll create a Fortran Quick Win
project...
…called splineqw...

…and include it into our current


workspace

Back to Main Menu


Select the Windows interface that best suits your application

Choose the
windowing
options that And the
best suit your Wizard inserts
application the new
project into
your
workspace

Back to Main Menu


…we’ll add
Now that some files to it
we’ve created
the splineqw
project...

Back to Main Menu


Locate the file you wish to insert

Be sure to insert it into


the correct project

Back to Main Menu


Fspline.f90 uses the
QuickWin graphics
library to draw a spline
curve that fits some data
points

Back to Main Menu


Before we can build
Splineqw.exe, we have
to link in file
splinedll.lib

We can do that by Instead of adding the link path,


adding the (relative) you can add the splinedll.lib file
path here in the Project to the project by using the Add to
settings dialog Project … Files item in the
Project menu
Back to Main Menu
Before we can run
splineqw.exe, we must
be sure that the system
can find splinedll.dll

The simplest way to assure this is


to physically move (or copy)
splinedll.dll into the directory
which contains our executable file,
splineqw.exe
Back to Main Menu
Build splineqw.exe

Back to Main Menu


In splineqw the user clicks on a
window and a spline curve is
displayed that best fits the
clicked points

Back to Main Menu


Next we’ll use Visual
C++ to build a new
Windows application
that uses splinedll.dll

We can perform mixed-


language programming using
Visual Fortran and Visual C++
in the same development
environment

Back to Main Menu


We’ll create a Visual C++
Win32 application
…called splinevc...

…and include it into our current


workspace

Back to Main Menu


Choose to build an empty project...

…and the AppWizard finishes the job

Back to Main Menu


Splinevc uses the
Microsoft Foundation
Classes to create a
user interface

Back to Main Menu


We must specify that we are using
the Microsoft Foundation Classes
under Project Settings

Back to Main Menu


Instead of adjusting the link
settings, splinedll.lib can be added
directly to the project!

Back to Main Menu


Before you attempt to build
any project, make sure it is
set as the Active Project

Back to Main Menu


Now we are ready to
build splinevc.exe Splinevc runs similarly
to splineqw

Back to Main Menu


The MFC application
has a different look to
it...

…but it performs the


same task

Back to Main Menu


Building a DLL
 We used Visual Fortran to build a dynamic link
library that contained functions to perform a
spline analysis
 Within the same Workspace we built two

applications that used the DLL: one written in


Fortran and the other in C++

Back to Main Menu


Main Menu

I would like to…


 Learn more about the Microsoft visual
development environment
 Learn more about mixed language programming
and dynamic link libraries
 Learn more about using COM objects with Visual
Fortran
 Learn about Visual Fortran Professional Edition
 Learn about the Compaq Array Visualizer
 End the presentation
Working with COM Objects
 Many windows applications provide a means of
accessing their functionality from another
program
 The Component Object Model (COM) is one such

mechanism

Back to Main Menu


Working with COM Objects
 COM is a language independent object model
designed for application interaction

But the Fortran language does not support objects
 The Visual Fortran Module Wizard allows you to
integrate COM objects into your Fortran
application development

Back to Main Menu


Working with COM Objects
 The Module Wizard creates Fortran module files
that provide an interface to functions used to
access COM objects
 The Fortran Module Wizard helps you create
Fortran applications (clients) that use existing COM
or Automation servers
 The Professional and Enterprise editions include

the ability to create an in-process COM server


(described in the section Visual Fortran
Professional Edition).

Back to Main Menu


Working with COM Objects
 We will now build a Console application that uses
the Module Wizard to access a COM Object
 dlines uses the visual development environment

itself to modify a Fortran source file


 Replaces “debug characters” in column 1 with
conditional compilation IF DEFINED directives

Back to Main Menu


Working with COM Objects
 dlines calls COM routines from Developer Studio
that:

Start the visual development environment running
 Open a file within the visual development

environment
 Perform editing functions on the open file

– replace text, go to the next line, etc.


 Save the file
 Close the application

Back to Main Menu


First we need to make
a new Project

Back to Main Menu


Named dlines

New Fortran Console Application

Back to Main Menu


Choose to build an empty project...

…and the AppWizard finishes the job

Back to Main Menu


Now let’s use the Module Choose Fortran
Wizard to create the Module Wizard
interface to the visual from the Tools
development environment’s menu
COM functions

Back to Main Menu


The Visual Fortran Module Wizard
We’ll be getting information
from a COM interface

Our Fortran module


will be named dsapp

Back to Main Menu


The Visual Fortran Module Wizard
C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\COMMON\MSDEV98\BIN\DEVSHL.DLL (Visual C++ Shared Objects)

Use the Visual C++


Shared Objects

You can specify which


COM Interfaces you
want access to

Back to Main Menu


The Visual Fortran Module Wizard

Might as well have access


Generate the Fortran to all of the COM Interfaces
module file

Back to Main Menu


The Visual Fortran Module Wizard

You can specify the name of


the source file containing
the Fortran modules

Back to Main Menu


The Visual Fortran Module Wizard
We’ll repeat the process
for another Developer
Studio COM Object

This module will


be called ds_text

Back to Main Menu


C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\COMMON\MSDEV98\BIN\DEVEDIT.PKG (Visual C++ Text Editor)

…select all of the Using the Visual C++


COM Interfaces Text Editor this time...
as before...

…generate the Fortran


module file and save it
as dstext.f90

Back to Main Menu


Add the files generated by the
Module Wizard to the dlines project

Back to Main Menu


dsapp.f90 was generated by
the Fortran Module Wizard

This is an INTERFACE to the function


IGenericDocument_Save(), which saves
the file open in the visual text editor

Back to Main Menu


Let’s add these sample files
which are located in your
samples\advanced\com\dlines
directory
Back to Main Menu
These two files make use of the
interfaces in dsapp and dstext

Back to Main Menu


After other COM functions are called
to modify the Fortran source file...

… $IGenericDocument_Save() is
called to save the changes

Now, let’s take a look at


the program in action

Back to Main Menu


[Mbcomp.for]

Execute the program

This Fortran fixed-format file


contains lines beginning with
the letters ‘D’ and ‘E’.

Visual Fortran allows only


“Debug Lines” that start with ‘D’

We’ll use dlines to change the


‘E’ debug lines to preprocessed
IF DEFINED statements

Back to Main Menu


dlines.exe

Specify the file on


which to operate*

The debug character and


the IF DEFINED variable
to replace it with

• Remember to use quotation marks when typing DOS pathnames that


contain spaces

Back to Main Menu


The ‘E’ debug lines have
Mbcomp2.for * been
replaced with conditional
compilation IF DEFINED
directives

Back to Main Menu


Working with COM Objects
 dlines made use of functions that are a part of a
Component Object Model Object
 The Visual Fortran Module Wizard was used to

create a Fortran module file that allowed dlines to


interact with Developer Studio
 dlines used functions that are a part of the visual

development environment to edit a Fortran


source file

Back to Main Menu


Main Menu

I would like to…


 Learn more about the Microsoft visual
development environment
 Learn more about mixed language programming
and dynamic link libraries
 Learn more about using COM objects with Visual
Fortran
 Learn about Visual Fortran Professional Edition

 Learn about the Compaq Array Visualizer

 End the presentation


Visual Fortran Professional Edition
 In addition to the Standard Edition, a Professional
Edition is available that includes:

The complete visual development environment
 IMSL numerical libraries

 Fortran COM Server Wizard and project type

 Compaq Array Visualizer

 The Enterprise Edition includes the Professional


Edition software, plus other software that lets you
use Visual Fortran (on a PC) to develop
applications for Compaq Tru64 UNIX and other
UNIX systems.
Back to Main Menu
Visual Fortran Professional Edition
 The Visual Numerics® IMSL numerical libraries provide
over 900 Fortran routines for performing advanced
mathematical algorithms

Applied mathematics

Statistical functions

Helper functions for printing, etc.
 IMSL libraries are available for many other OS/architecture
platforms (see http://www.vni.com)
 To call IMSL routines from Visual Fortran, add the

following USE statement:

USE Numerical_libraries

Back to Main Menu


Visual Fortran Professional Edition
 IMSL General Mathematics library
 Solving Linear Systems

Matrix and vector manipulation
 Eigenvalues and eigenvectors

 Integration and differentiation

 Differential equations

 Transforms


Printing, sorting, and other utilities

Back to Main Menu


Visual Fortran Professional Edition
 IMSL Statistics Library
 Basic statistics, regression, correlation

Analysis of variance
 Covariant structures and factor analysis

 Multidimensional scaling

 Density and hazard estimation

 Functions for printing console-based charts and

graphs (histogram, scatter, etc.)

Back to Main Menu


IMSL Library Example
 We will now build a Fortran Console application
that uses a couple of the IMSL statistics routines
 mnrain.exe plots some data in a vertical

histogram
 The data is the average precipitation in Minnesota
in the month of March

Back to Main Menu


IMSL Library Example
 This sample program comes from the IMSL
online documentation
 After looking at the online documentation, we will

build a Visual Fortran project

Back to Main Menu


The IMSL libraries come with extensive online
documentation as well as a number of example
programs

Back to Main Menu


In the contents, click Appendix B, Alphabetic
Summary of Routines. Locate VHSTP.
The VHSTP routine is in
Volume 2, so open the file STATVOL2.
Back to Main Menu
The IMSL documentation offers
information about the routine’s
usage and arguments

Back to Main Menu


This sample program calls
VHSTP to draw a vertical
histogram of some data It also uses another IMSL
routine, OWFRQ, to
tabulate the data

Let’s build this example


program using Visual Fortran
Back to Main Menu
Copy the program text from the
online help into a Visual Fortran
source file. In the Edit menu:
1. Click Select All.
2. Click Copy

Back to Main Menu


Back to Main Menu
mnrain - Compaq Visual Fortran

Now we need to add the


source code to our project

We’ve made a Fortran Console


Application and named it mnrain

So, we’ll create an empty


Fortran source file

Back to Main Menu


We want to make a new File...

Add it to the current


project (mnrain)

…named mnrain.for

We want it to be Fixed Format (.for)

Back
Back toto Main
Main Menu
Menu
mnrain - Compaq Visual Fortran

mnrain.for is open in the


editor
and has been added to the
project
Now, we’ll paste the IMSL
example into mnrain.for

Back to Main Menu


After we paste in the text from the IMSL documentation file,
edit the text to fit in fixed format:

1. Add the line: USE Numerical_Libraries


2. Comment out the line containing EXTERNAL
3. Change the single quote characters to
ASCII single quotation marks
4. Remove extra non-source text

Back to Main Menu


Let’s compile this file
to check for errors.

Back to Main Menu


Now let’s build and
execute the application

Back to Main Menu


mnrain.exe

By calling two IMSL library routines,


our data was tabulated and displayed
in this histogram

Back to Main Menu


Creating Fortran COM Servers
 Visual Fortran (all editions) provides the Fortran Module Wizard
to help generate code needed to use COM and Automation
objects (Fortran client applications).
 Visual Fortran Professional and Enterprise Editions also provide
the ability to create a Fortran COM server.
 The Fortran COM Server Wizard helps you generate a Fortran
application that creates a COM server or a server that supports
dual interfaces. The initial implementation in V6.5 supports only
in-process servers, loaded into the client's process.
 COM is language independent, so clients can be created by
Visual Basic, Visual C++, Visual Fortran, and other tools that
support COM.
 COM servers are reusable components, so multiple client
applications can use the server.

Back to Main Menu


Creating Fortran COM Servers
Creating a Fortran COM Server consists of these steps:
 Create a Fortran COM Server project. This includes specifying a
class name, interface name, and derived-type name. Select the
Fortran COM Server project type when creating the project.
 Use the Fortran COM Server Wizard to define the interface(s)
defined by the class, including the methods, properties, and
the arguments for each interface.
 When you build the project, the Fortran COM Server Wizard
generates code. You need to modify the source files by adding
code to supply the implementation of the methods.
 Test the Fortran COM server, by creating one or more clients to
access the server.
 Deploy the Fortran COM server.

Back to Main Menu


Creating Fortran COM Servers

The right pane


After you create the Fortran
shows the
COM Server project, you
properties of the
specify a Class name, Class
currently selected
The leftderived-type
pane shows name, and item (in this case
the COM Interface
server name. the COM Server
hierarchy. Adder)
When you click OK, the
Fortran COM Server Wizard
Theappears:
Fortran COM Server Wizard helps you
define the interface's methods, properties, and
their arguments.

Back to Main Menu


Creating Fortran COM Servers
Choose whether a
COM or dual interface
is needed

Expand the + signs


and click Iadd to
display the interface Adder is the COM server and also the
properties project name
AddingMachine is the class name
IAdd is the interface name
(interface names start with I)
AddingMachine_Instance is the Class
derived-type name

Back to Main Menu


Creating Fortran COM Servers
To add Clear and Add methods for the IAdd interface:
1. Select the IAdd interface
2. Click New
3. Select Method, type in Clear, and click OK
4. Repeat steps 1-3, specifying the name Add
5. Select the Add method
6. Click New
7. Select Argument, type in Operand, and
click OK
8. Specify the Fortran data type as REAL(4)
9. Let's assume you are done, so click Save
Creating Fortran COM Servers

Back to Main Menu


Creating Fortran COM Servers
Once you click Save,
your project appears.

The TODO.TXT file


informs you of changes
made to your project by
the Wizard, and lets
you know when you
In the FileView pane, need to make changes.
expand the + next to
Adder files and Source
Files folders.

Back to Main Menu


Creating Fortran COM Servers
 You need to modify the source files after lines that
start with ! TODO..., build the project, and then use
one of the clients to test the server.
 To activate the COM Server Wizard later, open your

Fortran COM Server project and click Fortran COM


Server Wizard in the View menu.
 For more information, see:

The Creating a COM Server chapter in the online
Programmers Guide.

The Adder sample in ...Samples\Advanced\COM\Adder,
which contains Visual C++ and Visual Fortran clients as
subprojects.

Back to Main Menu


Visual Fortran Professional Edition
 The Professional Edition includes the IMSL numerical
libraries, Fortran COM Server Wizard, and the
Compaq Array Visualizer. The Array Visualizer is
discussed in the next section.
 The Visual Fortran Enterprise Edition includes the

Visual Fortran Professional Edition, plus other


software that lets you use Visual Fortran on your x86
PC system to develop applications for Compaq Tru64
UNIX, and other UNIX and Linux systems. The
Enterprise Edition has a separate slide show.

Back to Main Menu


Main Menu

I would like to…


 Learn more about the Microsoft visual
development environment
 Learn more about mixed language programming
and dynamic link libraries
 Learn more about using COM objects with Visual
Fortran
 Learn about Visual Fortran Professional Edition

 Learn about the Compaq Array Visualizer

 End the presentation


The Compaq Array Visualizer
 Compaq Visual Fortran Professional and
Enterprise Editions are equipped with the
Compaq Array Visualizer
 The Array Visualizer uses ActiveX technology to

visualize multi-dimensional arrays of data


generated by Visual Fortran programs

Back to Main Menu


The Compaq Array Visualizer
 The Compaq Array Visualizer can be:
 Run as a standalone program called Array Viewer

Controlled by your Visual Fortran or Visual C++
application
 Embedded as an ActiveX control within a Visual

Fortran, Visual C++, or Visual Basic® application


 Used in conjunction with the visual development

environment to view large arrays while debugging

Back to Main Menu


The Compaq Array Visualizer
 Compaq Visual Fortran Professional and
Enterprise Editions give you full access to the
power of the Array Visualizer
 Build Applications that interact with the Array
Visualizer
 Use the Array Visualizer to view large multi-

dimensional arrays while debugging

Back to Main Menu


The Compaq Array Visualizer
 The Array Visualizer interacts with other
programs:

As an embedded ActiveX control in Visual Fortran,
Visual C++, and Visual Basic applications
 Operated via a simple set of function calls in C and

Fortran programs

Back to Main Menu


The Compaq Array Visualizer
 In the following slides we will see the Array
Visualizer at work

Rendering 3D graphs of array data
 Being controlled by a Visual Fortran Program

Back to Main Menu


The Compaq Array Viewer

The data in the


array are
displayed in this
grid

This pane contains a graphical view


of the data
Back to Main Menu
Clicking here brings up the
color bar

Back to Main Menu


The data in the array are
plotted along the z-axis

Each z-value is
assigned a color

The name and the type of the


array are shown here

Back to Main Menu


The red marker
is used to
indicate the
current array
element

Double-clicking on the graph


will update the marker and grid
accordingly

Back to Main Menu


Notice the new position of
the marker on the color
bar

The current array


element is listed here

Back to Main Menu


Just click and drag...

You can rotate the


graph using the
mouse

Back to Main Menu


The Compaq Array Viewer can
open array data files

Back to Main Menu


…and customize the colors
and scaling factors used in the
In addition, you can graph.
“zoom in” on a
specific region of the
graph...

Back to Main Menu


The Compaq Array Visualizer
allows you to create a Visual
Fortran application that uses the
Array Viewer.

Back to Main Menu


A set of Array Visualizer
Fortran routines lets your
application control the action
of the Array Viewer.

Back to Main Menu


This Array Visualizer
program displays an
array using the Array
Viewer... …makes some changes
to the array...

…and displays the modified result.

Back to Main Menu


In Visual Fortran Professional and
Enterprise Editions, the Array Viewer
can be used inside the debugger!

Back to Main Menu


Simple 2- Compaq Visual Fortran [break]

To view an array while


debugging, highlight the
variable name

Then click the Array Viewer


icon

Back to Main Menu


This array is supposed to store
sin(x) over the range 1 to 40

Clearly, something
is wrong!

Back to Main Menu


Using the Array Viewer, you
can easily recognize
inconsistencies in large sets
of data

Back to Main Menu


The Compaq Array Visualizer
 Visual Fortran Professional and Enterprise
Editions give you the full power of the Array
Visualizer
 Debug programs using the Array Viewer
 Write Fortran or C programs to control the Array

Viewer
 Use the Avis2d ActiveX control to control the Array

Viewer graphing modes and appearance


 Use the Avis Grid ActiveX control to create tables

of array data

Back to Main Menu


Main Menu

I would like to…


 Learn more about Microsoft visual development
environment
 Learn more about mixed language programming
and dynamic link libraries
 Learn more about using COM objects with Visual
Fortran
 Learn about Visual Fortran Professional Edition
 Learn about the Compaq Array Viewer
 End the presentation
Compaq Visual Fortran
Thank You for Viewing the
Compaq Visual Fortran Version 6.5
Product Overview

www.compaq.com
Visual Fortran

 Compaq, DIGITAL, and the Compaq logo are registered in the U.S. Patent and
Trademark office.
 OpenVMS and Tru64 UNIX are trademarks of Compaq Information
Technologies, L.C.
 ActiveX, Microsoft, MS, Microsoft Developer Studio, NT, PowerPoint, Visual
Basic, Visual C++, Win32, Windows, and Windows NT are either registered
trademarks or trademarks of Microsoft Corporation in the United States and other
countries.
 Intel and Pentium are registered trademarks of Intel Corporation.
 AMD and Athlon are trademarks of Advanced Micro Devices, Inc.
 IMSL and Visual Numerics are registered trademarks of Visual Numerics, Inc.
 UNIX and The Open Group are trademarks of The Open Group.
 All other trademarks and registered trademarks are the property of their
respective holders.
Compaq Visual Fortran
Compaq Visual Fortran Overview

© 1997-2000 Compaq Computer Corporation.

For more information about Compaq Fortran


please visit our web site at:
http://www.compaq.com/fortran

Compaq shall not be liable for technical or editorial errors or omissions contained
herein. The information in this document is subject to change without notice.

www.compaq.com
www.compaq.com

Potrebbero piacerti anche