Selecting your Compiler When Calling Pre-Compiled Files (*.obj, *.lib, *.dll)

When PSCAD projects will be calling any pre-compiled files, a compatible compiler must be selected for running your project.

A. Pre-compiled *.obj and *.lib Files

1. Background

When a PSCAD model is simulated, object files, executable files, and library files are generated as follows:

  • A Fortran compiler converts Fortran code files (*.f) to object files (*.obj).
  • A C compiler converts C-code files (*.c) to object files (*.obj).
  • Linker combines *.obj/*.lib files with the main entry point of the program to make an executable file (*.exe)
  • The “create compiled library” in Library projects uses Library tools to combine several object files (*.obj) to a single library (*.lib).

The generated files may be called into a PSCAD project, but the PSCAD project may then only be compiled using a compatible compiler. See Step 2 below for details on compatibility.

2. Compiler Compatibility

A compatible compiler must be used with a PSCAD project that calls any pre-compiled files (*.obj, *.lib, *.exe) (see Step 1 above). The following may be considered for your selection:

  • If the file was pre-compiled with third-party Intel® compiler - Only an Intel compiler may be used:

    Normally, it is expected that the same or newer version of Intel used to create the file can be used (backwards compatible).

    However, it may be possible that an older version of Intel could be used.

    Refer to this article for information on obtaining and setting up this compiler.

    Note that an additional third-party software is also required alongside the Intel compiler, Microsoft® Visual Studio. Refer to Step 3 below for further information.

  • If the file was pre-compiled with third-party GFortran - The same version of GFortran must be used:
    • A file pre-compiled using GFortran 4.2 must be run using GFortran 4.2.
    • A file pre-compiled using GFortran 4.6 must be run using GFortran 4.6.
    • A file pre-compiled using GFortran 8.1 must be run using GFortran 8.1.

  Refer to this article for information on obtaining and setting up this compiler.

  • If the file was pre-compiled with third-party Compaq Visual Fortran 6 - Only Compaq Visual Fortran 6 may be used:

    This compiler is supported with PSCAD v4.5.5 and older, and is no longer maintained.

The above compatibility information is documented in Chart 3.a of the Compatibilities Charts document, posted here.

3. Microsoft® Visual Studio

If a PSCAD project is calling a file that was pre-compiled using the Intel compiler (Step 2 above), then both the Intel compiler and Microsoft Visual Studio software (both third-party software) are required.

Please note the following compatibility information:

  • If the pre-compiled file contains only Fortran code, and does not contain any non-Fortran code (for example there is no C-code):
    It is normally expected that the same or newer version of Visual Studio used to generate the file can be used (backwards compatible). However, it may be possible that an older version of Visual Studio could be used.

  • Due to some changes to Visual Studio libraries at v2015, if the pre-compiled file contains any non-Fortran code (for example if it contains any C-code):

    • Files pre-compiled with Visual Studio 2013 and older are only compatible with Visual Studio 2013 and older, and

    • Files pre-compiled with Visual Studio 2015 and newer are only compatible with Visual Studio 2015 and newer.

For information on obtaining and setting up the Visual Studio software, please refer to this article.


B. Microsoft Visual C++ Runtime Libraries (Specific to dlls)

A pre-compiled dll will sometimes require a specific version of Microsoft Visual C++ Runtime Library to be installed.

In certain situations, the model sustains a reliance on a particular installed version of Visual C++. This reliance is likely not even be known by the model developer. When the end-user loads the model into PSCAD on their own machine, if the required version of Visual C++ is not present, the project can be built, but the run will terminate unexpectedly.

If it is suspected that a model has this issue, the following steps can be taken to verify the issue and determine the required version of Visual C++:

  • Build the project in PSCAD.

  • Open a Windows Command Prompt to the contents of the temporary folder that is created during a PSCAD build.
    The following image demonstrates how to do this using the simpleac project:

PSCAD - Open Win Cmd Prompt.png (245 KB)

  • In the Command Prompt, run the temporary executable file that was created during the build.
    Simply enter the name of the executable file (e.g. simpleac.exe), and press the Return button on the keyboard.
    This is shown in the following image:

Win Cmd Prompt - Run PSCAD example.png (32 KB)

  • The run will fail, but a message should display, indicating which Microsoft Visual c++ runtime library is missing.

Once the missing Visual C++ Runtime Library has been determined:

  • Download the software from the Microsoft website.

  • Install the software.

  • Log out then log back in on your machine.

  • Retest your model.

Back