+ All Categories
Home > Documents > Creating Mixed Language Projects with Microsoft Developer ... · Studio 2005, Intel Fortran, MS C++...

Creating Mixed Language Projects with Microsoft Developer ... · Studio 2005, Intel Fortran, MS C++...

Date post: 10-Jul-2020
Category:
Upload: others
View: 0 times
Download: 0 times
Share this document with a friend
17
Creating Mixed Language Projects with Microsoft Developer Studio 2005, Intel Fortran, MS C++ and Canaima Legacy Software Don Robinson ESSA Technologies November, 2007 These are the steps to follow to create an MS Developer Studios solution containing a Fortran project, a C project called from Fortran, and legacy products from Canaima software. The solution shown here is a Debug version, with compiler warnings and extra checking. The solution was created using: MS Developer Studio 2005 (Version 8.0.50727.762 (SP.050727-7600)) with Service Pack 1 and Security update); Intel Fortran compiler Version 10.0.027 [IA-32] (Compiler Integration reports 10.0.3718.2005); C++ compiler (Version 77626-009-0507101-41270) that ships with Dev Studio 2005; Canaima f90-SQL Professional (Version 2.00.001) 1. Canaima Legacy Software Canaima Software created software to link Fortran and ODBC for Digtal (DVF) and Lahey (LF95) compilers, but appears to have ceased operation (November 2007). It is possible to link their legacy code (consisting of .f90 and .mod templates and .lib and .dll libraries), although it is not thoroughly documented. The information in this document is accurate for the Professional version (2.00.001) but not for the Lite version. There are 2 redistributable files: Name Bytes Maker Version Notes DFORRT.DLL 458,792 Compaq 6.6.925.102 6.6 (Update A) f90SQLDVF.dll 43,009 Canaima None Ships with f90-SQL Pro 2.00.001 These are stored in the FVS Interface Vault repository (used for product builds, and not the same as the FVS repository). On installed applications these can be placed either in the \Windows\System32 directory, or in the same location as the final executable. These DLLs are necessary to run the executable created by a solution. There is 1 library file in the solution-level _Canaima project library repository (e.g., F:\Visual Studio 2005\FVS\ON\_Canaima\Lib). This library is necessary to build the solution. Name Bytes Maker Version Notes f90SQL.lib 251,140 Canaima None Ships with f90-SQL Pro 2.00.001 November, 2007 1 of 17 ESSA Technologies Ltd.
Transcript
Page 1: Creating Mixed Language Projects with Microsoft Developer ... · Studio 2005, Intel Fortran, MS C++ and Canaima Legacy Software Don Robinson ESSA Technologies November, 2007 These

Creating Mixed Language Projects with Microsoft Developer Studio 2005, Intel Fortran, MS C++ and Canaima Legacy Software Don Robinson ESSA Technologies November, 2007 These are the steps to follow to create an MS Developer Studios solution containing a Fortran project, a C project called from Fortran, and legacy products from Canaima software. The solution shown here is a Debug version, with compiler warnings and extra checking. The solution was created using: • MS Developer Studio 2005 (Version 8.0.50727.762 (SP.050727-7600)) with Service Pack 1 and

Security update); • Intel Fortran compiler Version 10.0.027 [IA-32] (Compiler Integration reports 10.0.3718.2005); • C++ compiler (Version 77626-009-0507101-41270) that ships with Dev Studio 2005; • Canaima f90-SQL Professional (Version 2.00.001)

1. Canaima Legacy Software Canaima Software created software to link Fortran and ODBC for Digtal (DVF) and Lahey (LF95) compilers, but appears to have ceased operation (November 2007). It is possible to link their legacy code (consisting of .f90 and .mod templates and .lib and .dll libraries), although it is not thoroughly documented. The information in this document is accurate for the Professional version (2.00.001) but not for the Lite version. There are 2 redistributable files: Name Bytes Maker Version Notes DFORRT.DLL 458,792 Compaq 6.6.925.102 6.6 (Update A) f90SQLDVF.dll 43,009 Canaima None Ships with f90-SQL Pro 2.00.001

These are stored in the FVS Interface Vault repository (used for product builds, and not the same as the FVS repository). On installed applications these can be placed either in the \Windows\System32 directory, or in the same location as the final executable. These DLLs are necessary to run the executable created by a solution. There is 1 library file in the solution-level _Canaima project library repository (e.g., F:\Visual Studio 2005\FVS\ON\_Canaima\Lib). This library is necessary to build the solution. Name Bytes Maker Version Notes f90SQL.lib 251,140 Canaima None Ships with f90-SQL Pro 2.00.001

November, 2007 1 of 17 ESSA Technologies Ltd.

Page 2: Creating Mixed Language Projects with Microsoft Developer ... · Studio 2005, Intel Fortran, MS C++ and Canaima Legacy Software Don Robinson ESSA Technologies November, 2007 These

There are 6 template files in the solution-level _Canaima project include repository (e.g., F:\Visual Studio 2005\FVS\ON\_Canaima\Include): Name Bytes Maker Version Notes f90SQL.f90 153,309 Canaima/

Intel/ ESSA

2.01.001 Modified from 2.00.001 by adding attributes for all subroutines based on example from f90-SQL Lite provided by Steve Lionel (Intel).

f90SQL.mod 195,496 ESSA Created by recompiling f90SQL.f90 f90SQLConstants.f90 136,687 Canaima 2.00.001 Unchanged from original release f90SQLConstants.mod 183,585 Canaima Unchanged from original release F90SQLStructures.f90 13,115 Canaima 2.00.001 Unchanged from original release f90SQLStructures.mod 23,657 Canaima Unchanged from original release

2. Create a Vault Project If the project is to be managed with Vault source control, see that you have a Vault project set up beforehand, with at least some of the code you will need. It can be augmented later with other code, but works most easily if the basic folder structure is already there. This image shows the folder structure for the ON project (FVSOntario), part of the FVS repository.

November, 2007 2 of 17 ESSA Technologies Ltd.

Page 3: Creating Mixed Language Projects with Microsoft Developer ... · Studio 2005, Intel Fortran, MS C++ and Canaima Legacy Software Don Robinson ESSA Technologies November, 2007 These

3. Create an Empty Dev Studio Project (the Solution) Next, create a project using a base directory within MS Developer Studio subdirectory (e.g., F:\Visual Studio 2005\FVS). Dev Studio will create a directory for the solution, (e.g., F:\Visual Studio 2005\FVS\ON) and this top level folder will be mapped to the Vault folders for the project. Using File > New Project within Dev Studio, create an empty solution with no content (yet), checking the Add to Source Control checkbox, as shown below:

Assuming you have Vault set up as your source control provider, the Vault UI will start up and prompt you for the Vault project and folder you want to associate with the Dev Studio project: (see screen capture below).

November, 2007 3 of 17 ESSA Technologies Ltd.

Page 4: Creating Mixed Language Projects with Microsoft Developer ... · Studio 2005, Intel Fortran, MS C++ and Canaima Legacy Software Don Robinson ESSA Technologies November, 2007 These

Once this step is done, Dev Studio will have created the directory and a few files as shown below. The ON.sln and ON.vssscc files are added to the Vault folder in a checked-out state.

Save the MS Dev project and check in/out the solution. Saving at this point will help if anything goes wrong later on.

November, 2007 4 of 17 ESSA Technologies Ltd.

Page 5: Creating Mixed Language Projects with Microsoft Developer ... · Studio 2005, Intel Fortran, MS C++ and Canaima Legacy Software Don Robinson ESSA Technologies November, 2007 These

4. Add a C++ Project to the Solution If you want to have a mixed language Fortran/C application, it seems to be necessary to create the C-language project first! Add a new project, creating one called fofem1.

Although it will end up being linked to a Fortran driver program, it starts life as a Win32 Console application:

1 “fofem” is an acronym of “First Order Fire Effects Model”

November, 2007 5 of 17 ESSA Technologies Ltd.

Page 6: Creating Mixed Language Projects with Microsoft Developer ... · Studio 2005, Intel Fortran, MS C++ and Canaima Legacy Software Don Robinson ESSA Technologies November, 2007 These

After pressing OK, an application wizard starts. Select Application Settings and check the Static library radio button and uncheck the Precompiled header check box.

After pressing Finish, Dev Studio will create and add the fofem project, along with a default file. We don’t need the default file (Readme.txt). Remove it from with Dev Studio by right-clicking then selecting Remove/Delete for each.

November, 2007 6 of 17 ESSA Technologies Ltd.

Page 7: Creating Mixed Language Projects with Microsoft Developer ... · Studio 2005, Intel Fortran, MS C++ and Canaima Legacy Software Don Robinson ESSA Technologies November, 2007 These

5. Add a Fortran Project to the Solution

You must have the Intel Fortran compiler installed for this next step. As shown at left, add/create a new project, much as you did for the C-language project, giving it the ON name. You need to use File > Add from the menu to add a new project, as shown.

This creates an empty Fortran project “ON” one level below the Solution directory of the same name.

November, 2007 7 of 17 ESSA Technologies Ltd.

Page 8: Creating Mixed Language Projects with Microsoft Developer ... · Studio 2005, Intel Fortran, MS C++ and Canaima Legacy Software Don Robinson ESSA Technologies November, 2007 These

6. Move the Projects to a Common Location (Optional) The C and Fortran projects you just created are stored in subdirectories below the ON solution directory:

To be most compatible with Vault and the standard file structure used by other FVS developers, this isn’t the way we want to set things up. So even though it was just created; unload the fofem project by right clicking as shown at left, in preparation for moving and re-attaching it. Unload the fofem project first, and don’t try to do them both at the same time.

November, 2007 8 of 17 ESSA Technologies Ltd.

Page 9: Creating Mixed Language Projects with Microsoft Developer ... · Studio 2005, Intel Fortran, MS C++ and Canaima Legacy Software Don Robinson ESSA Technologies November, 2007 These

Once it is unloaded, use Windows Explorer to select and move the fofem project files, moving them UP one directory, into the parent ON directory. You can then delete the empty fofem subdirectory. Then, from within Dev Studio, right click the unloaded fofem project and select Remove, to remove it from the solution. Next, using File > Add, add the fofem project back (now up one subdirectory), as shown below: The first project is now moved.

Now do the same thing with the Fortran project:

(1) unload the project; (2) move the project files up into the parent

solution subdirectory; (3) remove the empty Fortran project

subdirectory; (4) remove the project from the solution; (5) add the moved project files back into the

solution, as you did for the C language project.

November, 2007 9 of 17 ESSA Technologies Ltd.

Page 10: Creating Mixed Language Projects with Microsoft Developer ... · Studio 2005, Intel Fortran, MS C++ and Canaima Legacy Software Don Robinson ESSA Technologies November, 2007 These

The Dev Studio project will now look like this

The corresponding files will look like this:

Right click the solution icon in Dev Studio to check in the solution. The Fortran and C projects will be added to source control automatically.

November, 2007 10 of 17 ESSA Technologies Ltd.

Page 11: Creating Mixed Language Projects with Microsoft Developer ... · Studio 2005, Intel Fortran, MS C++ and Canaima Legacy Software Don Robinson ESSA Technologies November, 2007 These

7. Add Files to the Project Move to the Vault UI and verify that the Working folder is “F:\Visual Studio 2005\FVS\ON.” Select and right-click the $/ON project, then choose ‘Get Latest Version’ to add all the necessary ON source code (both languages) to your workstation. This will create directories as necessary in subdirectories below the solution directory2.

2 This differs from the way earlier versions of Vault worked with MS Dev Studio 98. Vault now requires that working folders for shared files be in distinct locations, which can create duplication of files on the workstation if multiple solutions have source code files in common. If file space is a problem, the workstation-side files can be removed and reloaded from Vault when required.

November, 2007 11 of 17 ESSA Technologies Ltd.

Page 12: Creating Mixed Language Projects with Microsoft Developer ... · Studio 2005, Intel Fortran, MS C++ and Canaima Legacy Software Don Robinson ESSA Technologies November, 2007 These

Starting with the C-language fofem project, add existing items to the project, as shown. You will need to browse into the fire\fofem\src directory to add all the C-language source code.

The source and include files will be added to the project in checked-out mode. Move the .h files into the Header folder by dragging and dropping. Once this has been done, perform an ‘Undo Checkout’ on all the files. Next, add all the Fortran language files. You need to work systematically through all the source code folders, moving .f77 files into the Header files of the Fortran ON project. You can also include the Canaima .for template files as resources if you wish, but they should be marked for non-compilation.

November, 2007 12 of 17 ESSA Technologies Ltd.

Page 13: Creating Mixed Language Projects with Microsoft Developer ... · Studio 2005, Intel Fortran, MS C++ and Canaima Legacy Software Don Robinson ESSA Technologies November, 2007 These

8. Customize Dev Studio After the source files have been included, the Dev Studio environment needs to be customized. This customization will affect all solutions and projects in any languages used by Dev Studio. Select Tools > Options, then find and expand the Intel(R) Fortran node. Select the Libraries edit button and add “F:\FVS\_Canaima\Lib to the library search list. The full pathname you provide here will depend on where this directory is found on your workstation. This is the only customization required at the Dev Studio level.

November, 2007 13 of 17 ESSA Technologies Ltd.

Page 14: Creating Mixed Language Projects with Microsoft Developer ... · Studio 2005, Intel Fortran, MS C++ and Canaima Legacy Software Don Robinson ESSA Technologies November, 2007 These

9. Customize the Project Properties Customize the fofem project by right-clicking on the fofem icon and selecting Properties. Open the C++ node on the General branch set the Warning Level from /W3 to /W1 (the fofem code is quite sloppy).

Next, open the Preprocessor branch and add ANSI to the Preprocessor definitions.

November, 2007 14 of 17 ESSA Technologies Ltd.

Page 15: Creating Mixed Language Projects with Microsoft Developer ... · Studio 2005, Intel Fortran, MS C++ and Canaima Legacy Software Don Robinson ESSA Technologies November, 2007 These

Customize the ON Fortran-project by right-clicking the project icon and selecting Properties. Open the Fortran node and on the General branch, click on the blank space to the right of “Additional Include Directories” and select <Edit>. Add the lines shown below: These directories contain .f77 include files

November, 2007 15 of 17 ESSA Technologies Ltd.

Page 16: Creating Mixed Language Projects with Microsoft Developer ... · Studio 2005, Intel Fortran, MS C++ and Canaima Legacy Software Don Robinson ESSA Technologies November, 2007 These

Finally, select the Linker node and open the Input branch. On the Additional Dependencies line, add f90sql.lib.

November, 2007 16 of 17 ESSA Technologies Ltd.

Page 17: Creating Mixed Language Projects with Microsoft Developer ... · Studio 2005, Intel Fortran, MS C++ and Canaima Legacy Software Don Robinson ESSA Technologies November, 2007 These

Customize the ON Solution by right-clicking the Solution icon and selecting Properties. Open the Common Properties node and select the Startup branch. Set ON as the Single startup project

Next, select the Project Dependencies branch and set it so that fofem depends on ON:

November, 2007 17 of 17 ESSA Technologies Ltd.


Recommended