Mi carrito | Mi perfil | Ayuda | English Site    

Productos:
 Búsqueda rápida:
 
Soluciones para:
Mi perfil:
Sobre Aertia:
 

Lahey/Fujitsu Fortran v7.1

de Lahey Computer Systems

Lahey/Fujitsu Fortran v7.1 es una versión del lenguaje Fortran para compiladores .NET que incluye soporte para Visual Studio .NET 2003, diseñadores Windows & Web Forms, extensiones Fortran 2003, soporte de COM y ADO.NET, y plantillas de código .NET y Win32. Se trata de un compilador Fortran 95, optimizado para trabajar en arquitecturas Pentium 4 y Athlon, con rápidas librerías matemáticas y un paquete gráfico incluído.

Descripción | Más información | Demos | Precios | Sectores | Plataformas

.NET Whitepaper

Contents

Introduction
.NET is a Microsoft initiative that focuses on distributed computing and software development productivity. The infrastructure technology supporting that initiative is the .NET Framework. Within this Framework, an application written in multiple languages can share data across multiple platforms with other applications. Technologies such as .NET Web Services and ASP.NET, and .NET programming languages, such as Microsoft C#, Visual Basic.NET, and Visual C++.NET, make all this possible. A vast set of new tools and libraries are unified to make developers, regardless of programming language, more productive than ever before. Given the enormous amount of Fortran code that exists today and customers' increased desire to connect the world, Lahey Computer Systems, Inc. and Fujitsu Limited have teamed up to integrate Lahey/Fujitsu Fortran with the Microsoft .NET Framework and the Visual Studio.NET development environment. This effort has brought to market a new Fortran compiler, Fortran for .NET, that targets this .NET platform.

A New Fortran . . . Not your Father's Fortran.
A Fortran application developed for the Microsoft .NET Framework can take advantage of the many benefits of the .NET infrastructure, including:

  • Unprecedented interoperability with other .NET languages
  • Code reuse by any .NET language
  • Easier access to system services
  • Built-in error handling
  • Automatic memory management (garbage collection)
  • Multiple side-by-side application versions
  • Easier application deployment
  • Interoperability with COM
  • Fortran source embedded in ASP.NET pages for server-side compilation and execution
  • Exposing procedures as XML Web Services
  • Use of the enormous .NET Framework class library
  • Use of many tools developed for the Common Language Runtime (CLR)
  • Easier Internet and database access
  • Ability to run on non-Windows platforms that support the CLR

The key to Fortran users getting access to these benefits is to use a compiler that generates Microsoft Intermediate Language (MSIL), rather than native machine code. A just-in-time (JIT) compiler provided by the .NET Framework compiles and links the MSIL for execution at the moment an object is needed. The Fortran for .NET compiler generates MSIL and has language extensions for object-oriented features and for interoperability with other .NET languages. The specifications of the compiler adhere to the Fortran 2003 Draft Standard whenever possible.

Fortran for .NET supports object-oriented programming features that were not present in Fortran 95. The Fortran 2003 Draft Standard specifies the implementation of many of these features, including:

  • Class definition
  • Method declaration
  • Overloaded method declaration
  • Class extensibility
  • Inheritance
  • Polymorphism
  • Enumerator definition and operations
  • Procedure pointers
  • Type aliasing
  • Dynamic type allocation

For full interoperability with other .NET languages, and to be compliant with the Common Language Specification (CLS), Fortran for .NET contains new language extensions including support for the following features:

  • Static/instance/overloaded/override methods
  • Static/instance fields
  • Static/instance/override properties
  • Static/instance constructors
  • Interface use
  • Base class access
  • 'This' object access
  • Public/private/protected/internal accessibility
  • Delegate definition and instantiation
  • Namespace definition and use
  • Throw/try/catch exception handling
  • Custom attributes
  • Invoke unmanaged code (native DLL)
  • Common Type Specification (CTS) string and unsigned integer data types
  • Unicode characters

Fortran for Visual Studio .NET.
Lahey/Fujitsu Fortran integrates with Microsoft Visual Studio .NET, a world-class integrated development environment (IDE). This gives Lahey Fortran programmers easy access to .NET Framework development tools, massive online help content, and allows seamless debugging of multi-language programs. Developers can have everything they might expect for making the development task easier, such as:

  • Windows Forms Designer
  • Web Forms Designer
  • Solution management (groups of projects)
  • Project management
  • Project/Code templates
  • Syntax recognition
  • Debugging
  • Integrated help
  • Deployment Tools

Of special significance is the Lahey/Fujitsu Fortran for .NET integration with Visual Studio.NET Windows Forms and Web Forms. The Windows Forms Designer makes it easy to develop drag-and-drop Win32 GUI applications with event-driven Fortran code behind the controls; Web Forms is a similar designer for developing web pages.

Fortran for ASP.NET.
Microsoft's ASP.NET is the next generation of ASP (Active Server Pages). It supports an infrastructure to resolve many of the difficulties and deficiencies of earlier web programming methods. This includes making it easier to design and program web pages with the Web Forms designer (available in Visual Studio.NET). It also includes built-in mechanisms for security, user authentication, and state management. ASP.NET improves performance by server-side compilation of the executable content of the page to native code when the page is first deployed.

Fortran for .NET allows Fortran users the ability to embed Fortran code within ASP.NET pages, interleaved with HTML and ASP content. Fortran code can also be external to the page (known as code-behind) which results in better source code reuse and readability. When instructed to use Fortran, ASP.NET utilizes the Fortran for .NET compiler to execute the logic and generate dynamic content output, and posts the HTML back to the browser. When developing with the Web Forms designer in Visual Studio .NET, creating controls on the page is drag-and-drop, with easily modifiable properties and quick access to the Fortran code template for programming the event-driven procedures.

Fortran for .NET Web Services.
Today, the Internet and browsers mostly provide a glorified display function, but fall short on programmability. .NET Web services allow applications and web pages to easily call class methods of .NET objects that reside on a web server. The communication can take place via the standard HTTP POST/GET or the more richly featured Simple Object Access Protocol (SOAP), a hybrid of HTTP and XML. XML-based standards, defined by the World Wide Web Consortium, provide a universal data format readily adaptable to network communications, regardless of the operating system or programming language.

Fortran for .NET delivers the tools you need to expose your Fortran methods (procedures) to the Internet. One directive in the source code is all you need to make your .NET object's method web-service-enabled. ASP.NET handles most of the Internet functionality automatically:

  1. The server receives an HTTP request with your method name and optional parameters encoded in the URL or XML;
  2. ASP.NET instantiates your .NET object and calls the specified method;
  3. the method's results are returned to ASP.NET;
  4. ASP.NET returns the results, converted to XML, back to the client.

ASP.NET also provides a browser-based client for testing your web service.

A key part of Web Services usability is the Web Services Description Language (WSDL). From anywhere on the Internet, the ASP.NET server can be polled for the names of the available web service procedures, the parameters required, and the protocols they support. This information is returned by ASP.NET in a WSDL format file. The .NET SDK provides tools to analyze the WSDL, and Fortran for .NET provides a code generator to automatically create code (a proxy class) for calling the web service. This gives your application access to web services that may have been written in any .NET language, on a server anywhere on the web. Furthermore, the .NET SOAP class library has functions available to call the web service asynchronously so your application does not have to wait for the web server to respond.

Will my older source compile without changes?
Our goal is to provide a compiler that will compile most customers' source without changes. However, Fortran for .NET has some language restrictions at this time. Code that cannot be compiled by the Fortran for .NET compiler and that does not require .NET interoperability can be accessed as an unmanaged (native Win32) DLL. These unmanaged DLLs can be developed and built with the traditional Lahey/Fujitsu Fortran 95 compiler that is also integrated into Visual Studio .NET.

Legacy Fortran programs are automatically and transparently converted to classes by the Fortran for .NET compiler without any need for source changes: main programs and external procedures are automatically implemented as a class definition; internal procedures are made static private methods; module names will be treated as a namespace name; derived types and their components become classes and class fields (referenced by the exact same syntax as in Fortran 95), or structures if the sequence statement is present.

To take advantage of creating public classes with methods that can be called from other .NET programs, source code changes will be necessary.

What about execution speed?
The advantages of JIT compilation, and the security, garbage collection, type safety, and other features of .NET, cannot all be gained without some costs in overhead. If execution speed performance becomes an issue with a .NET application, there are some ways to increase performance. One way is to pre-JIT the .NET assembly (the self-describing collection of IL, metadata, and resources), so that it is already compiled into native code (restrictions apply). Another way is use the Lahey/Fujitsu Fortran 95 compiler to create a native DLL, and call it from the Fortran for .NET application.

The early releases of Fortran for .NET have limited optimizations for the MSIL code generation. Future improvements in this area, coupled with Microsoft's improvements to future releases of the CLR, will result in closing the gap between the execution speed of managed and unmanaged code.

Why Fortran?
You might remember the meaning of FORTRAN: FORmula TRANslator. Fortran enables a programmer to put a mathematical or scientific formula expression directly into the source code and be confident that it will calculate that expression accurately. Fortran has semantics that facilitate array operations and computations. Fortran has all of the intrinsic routines to make these math and science problems and simulations easier to program. Lahey and Fujitsu will always be focused on developing better compiler optimizations to make your code run faster, and on having the best compile and runtime diagnostics to help you have confidence in your application. And now, Lahey/Fujitsu Fortran will offer the many advantages of a true object-oriented language.

Source Code Example
The following is a Fortran for .NET console application that invokes C#, Fortran, and Visual Basic .NET class methods. The Fortran and VB classes inherit a method from the C# base class and override another method. This can be interpreted as: the Fortran main is the dog trainer, and the Fortran and VB dogs inherited the roll-over behavior from the C# dog, but have their own bark behavior - a canine example of object-oriented programming.

Fortran for .NET
! This is the main program
Program MultiDog   
   ! Make the .NET Framework's System namespace and the VirtualDog
   ! namespaces defined below accessible to this program
   use System
   use VirtualDog   
   ! Define variables of the three dog types (classes)
   type (Dog) :: d
   type (Greyhound) :: g
   type (Labrador) :: l   
   ! Call the RollOver methods (procedures) of each class
   call d%RollOver()   ! Call C#
   call g%RollOver()   ! Call Fortran
   call l%RollOver()   ! Call Visual Basic
end program MultiDog

module   
   ! Define a type (class) called Greyhound that extends
   ! the Dog class defined in C# code below, and is part of
   ! the VirtualDog namespace
   type, extends( VirtualDog%Dog ), namespace( VirtualDog ) :: Greyhound
   contains   
      ! Declare a class method (procedure); the 'pass'
      ! attribute makes it an instance (dynamic) procedure
      procedure, public, pass ::  Bark
   end type Greyhound
contains   
   ! Define the Bark method that overrides the inherited
   ! class' method; i.e., give the Greyhound its own bark
   subroutine Bark( this )   
      ! Declare the passed-object (hidden argument in the
      ! call statement) as the same type as the class
      class ( Greyhound ) :: this
      print *, "BOW WOW (Fortran Dog)"
   end subroutine Bark
end module

C#
// Make the .NET Framework's System
// namespace accessible to this program
using System;   
// Be a part of the VirtualDog namespace
namespace VirtualDog {   
   // Define an overridable class called Dog
   public class Dog {   
      // Define overridable methods of the class
      public virtual void RollOver () {
         Console.WriteLine(" Scratch my tummy.");   
         // The Bark method is called here. It is overridden
         // sometimes in the Fortran and VB classes
         Bark();
      }
      public virtual void Bark () {
         Console.WriteLine(" WOOF WOOF (C# Dog)");
      }
   }
}

Visual Basic .NET
' Make the .NET Framework's System
' namespace accessible to this program
Imports System   
' Be a part of the VirtualDog namespace
Namespace VirtualDog   
   ' Define a type (class) called Labrador that extends
   ' the Dog class defined in C# code above
   Public Class Labrador : Inherits Dog   
      ' Define the Bark method that overrides the inherited
      ' class' method; i.e., give the Labrador its own bark
      Public overrides Sub Bark ()
         Console.WriteLine(" WAF WAF (VB Dog)")
      End Sub
   End Class
End Namespace
 
Más información relacionada
Fortran para arquitecturas .NET
Fortran 95 (Win32) language system
.NET Whitepaper
Lahey Fortran -C Compiler manual- (en inglés)
 
  ACCIONES
» Enviar a un amigo
» Imprimir página
» Suscribirse a este producto

» Ver precios
» Ver productos de Lahey Computer Systems

MÁS INFORMACIÓN
» Fortran para arquitecturas .NET
» Fortran 95 (Win32) language system
» .NET Whitepaper
» Lahey Fortran -C Compiler manual-
 

 
© 2004-2005 Aertia Software  •  C/ Sardenya, 229, Sat. 5  •  08013 Barcelona
Teléfono: 93 2651320  •  Fax: 93 2652351  •  E-mail: info@aertia.com