.NET Programming

FTN95 can create code for either a .NET platform or a Win32 platform. When working from Visual Studio you select the platform when a project is created. The platform can be changed from the Configuration Manager dialog (see A Simple Fortran Project). When working from a command line, by default FTN95 produces code for a Win32 platform whilst the command line switch /CLR selects the .NET platform.

With version 6.35 and above of FTN95 different versions of the .NET Framework can be targeted. To target version 2.0 of the .NET Framework use /CLR along with /CLR_VER 2 and to target version 4.0 of the .NET Framework use /CLR along with /CLR_VER 4. Note that versions 3.0 and 3.5 of the .NET framework are actually extensions to the core of 2.0.

For a Win32 platform, .OBJ files generated by FTN95 are linked using SLINK to produce a .EXE or .DLL file. This process is hidden from the user when working from Visual studio. The call to SLINK is also hidden when /LINK or /LGO are used with FTN95 on a command line.

For a .NET platform, .DBK files are generated by FTN95 and linked using DBK_LINK2 (for version 2 of the .NET Framework) or DBK_LINK4 (for version 4 of the .NET Framework) to produce a .NET assembly (a .EXE or .DLL file) or a .NET module (this is different from a Fortran module). The resulting assembly or module uses an intemediate language that is translated into machine instructions when it is run or installed. The software that does the translation is known as a JIT (Just In Time) compiler and is built into the .NET environment. Each individual .NET platform will have its own JIT compiler.

As of version 6.35 of FTN95, support for version 1.1 of the .NET Framework and DBK_LINK has been removed.

The .NET environment provides a much greater inter-operability between different computer languages and facilitates linking software to the web. It also allows software to be insulated from many of the vagaries of hardware because these matters can now be handled by the JIT compiler.

FTN95 can produce .NET code from existing Fortran programs. These must be either Standard conforming programs or programs that use only Silverfrost Fortran extensions (ClearWin+ programs must be rewritten for .NET). This means that, in many cases, all that you have to do is recompile your existing code in order to create a .NET application.

Targeting different versions of the .NET Framework

To target version 2.0 of the .NET Framework:

Use /CLR and CLR_VER 2 on the command line for FTN95 and use the linker DBK_LINK2. When using Visual Studio 2005 or 2008, version 2.0 of the .NET Framework is targeted by default.

To target version 4.0 of the .NET Framework:

Use /CLR and CLR_VER 4 on the command line for FTN95 and use the linker DBK_LINK4. When using Visual Studio 2010, version 4.0 of the .NET Framework is targeted by default.

Previous users of FTN95 may need to make any changes to build scripts if version 1.1 of the .NET Framework was being targeted using DBK_LINK. Support for version 1.1 of the .NET Framework and DBK_LINK has been removed as version 6.35.

 

 

Basket
Empty
 
Copyright © 1999-2024 Silverfrost Limited