Computing: DOS, OS/2 & Windows Programming

Installation of the plotting library DISLIN for various programming languages.

"DISLIN is a high-level plotting library for displaying data as curves, polar plots, bar graphs, pie charts, 3D-color plots, surfaces, contours and maps. DISLIN is intended to be a powerful and easy to use software package for scientists and programmers. There are only a few graphics routines with a short parameter list needed to display the desired graphical output. A large variety of parameter setting routines can then be called to create individually customized graphics."

The previous paragraph is how the software is described on the DISLIN Home page. I did not try to create my own plots (so I can't say how easy or difficult it is to use the software), but the examples provided look rather amazing. And, you cannot only plot functions, charts, maps and similar, but it's also possible to create application GUIs! Thus, a nice possibility to create desktop applications with languages like Perl or Python.

You can download the 64-bit installer of the library for given programming languages at the DISLIN Download page. Installation is always the same: Unpack the ZIP archive to some temporary directory, and run the installer program setup.exe.

In the following paragraphs, I show how to install the DISLIN library for FreeBASIC, .NET (C#, Visual Basic), Free Pascal, Perl, and Python. I failed to build programs using the gcc/gfortran library, and also using the library for Intel Fortran. Maybe that there is really an issue, maybe that it's just me who missed something (?).

I tested DISLIN 11.5 for FreeBASIC on Windows 10 Potato, DISLIN for .NET on Windows 11, all others on Windows 10 Home. Normally, everything should work fine with all versions of Windows 10/11, maybe also with older Windows releases.

Installing DISLIN for FreeBASIC.

The archive to download is called dl<NN>_fb.zip, where NN is the version number. Unpack the archive and run setup.exe. The default installation directory is C:\dislin; I changed this, and installed the software to C:\Programs\dislin.

DISLIN on Windows: DISLIN for FreeBASIC - Setting the installation directory

Two resp. three steps to do in order to configure the DISLIN installation:

  1. Create the new environment variable DISLIN and set it to your DISLIN installation directory (in my case: C:\Programs\dislin).
  2. Add the win subdirectory of the DISLIN installation directory (in my case: C:\Programs\dislin\win) to your PATH environment variable.
  3. In order to be able to run the FreeBASIC compiler from any directory, add the FreeBASIC installation directory (in my case: C:\Programs\FreeBASIC) to your PATH environment variable.

The provided FreeBASIC examples are located in the examples\freebasic subdirectory. To build them, cd to that directory and run the FreeBASIC compiler as follows:
    fbc64 -i <DISLIN-install-dir> -p <DISLIN-install-dir> <source-file>.bas
for example, to build the program bars.bas:
    fbc64 -i C:\Programs\dislin -p C:\Programs\dislin bars.bas

DISLIN on Windows: DISLIN for FreeBASIC - Building the provided example bars.bas

For further details, run readme.exe from the dislin\win directory (or from the Windows Start menu).

The screenshot below shows the execution of bars.exe (created by the build).

DISLIN on Windows: DISLIN for FreeBASIC - Running the provided example bars.exe

Installing DISLIN for .NET.

The archive to download is called dl<NN>_cs.zip, where NN is the version number. Unpack the archive and run setup.exe. The default installation directory is C:\dislin; I changed this, and installed the software to C:\Programs\dislin.

Three resp. four (five) steps to do in order to configure the DISLIN installation:

  1. Create the new environment variable DISLIN and set it to your DISLIN installation directory (in my case: C:\Programs\dislin).
  2. Add the win subdirectory of the DISLIN installation directory (in my case: C:\Programs\dislin\win) to your PATH environment variable.
  3. Copy the file dislin.dll (from the DISLIN installation directory) to the directories containing the .NET examples (examples\cs, examples\vb, examples\cpp).
  4. In order to be able to run the C# and Visual Basic compilers from any directory, add the directory that contains the files csc.exe and vbc.exe (search your Visual Basic installation to find the files...) to your PATH environment variable.
  5. In order to be able to run the C++ compiler from any directory, add the directory that contains the file cl.exe (search your Visual Basic installation to find the file...) to your PATH environment variable.

Note: I tested the .NET examples using the compilers of Visual Studio 2022. Not sure, if all works correctly with earlier versions (?)...

To build the provided C# example color3d.cs, cd to the directory examples\cs and run the command
    csc color3d.cs -r:disnet.dll

To build the provided Visual Basic example world.vb, cd to the directory examples\vb and run the command
    vbc color3d.cs -r:disnet.dll

The screenshot shows the build (and execution) of world.vb.

DISLIN on Windows: DISLIN for .NET - Building the provided example world.vb

Here is the screenshot of the execution of color3d.exe (created by the build of color3d.cs).

DISLIN on Windows: DISLIN for .NET - Running the provided example color3d.exe (C#)

And here is the screenshot of the execution of world.exe (created by the build of world.vb).

DISLIN on Windows: DISLIN for .NET - Running the provided example world.exe (VB)

To build the provided C++ example legend.cpp, cd to the directory examples\cpp and run the command
    cl /clr legend.cpp

Actually, my build aborted with the linker error message Cannot open file 'MSVCRT.lib'

DISLIN on Windows: DISLIN for .NET - Failure to build the provided example legend.cpp

You can find the 64-bit DLL in some folder of your Visual Studio installation. Copying it to the directory containing the C++ source file doesn't help, however: There are several other DLLs needed. Not even sure, if all of them are actually available among the Visual Studio files. This last sentence means that I did not further try to get the build work. I suppose that if you have all DLLs together, everything will (very probably) work correctly (?).

Installing DISLIN for Free Pascal.

The archive to download is called dl<NN>_fp.zip, where NN is the version number. Unpack the archive and run setup.exe. The "problem" that I had here was that I intended to install DISLIN for Free Pascal, DISLIN for Perl, and DISLIN for Python on the same machine. Wanting to be sure that there aren't any files overwritten, I decided to use three different installation directories, all of them subdirectories of C:\Programs\dislin. So, I installed DISLIN for Free Pascal to C:\Programs\dislin\fpc.

DISLIN on Windows: DISLIN for Free Pascal - Setting the installation directory

Doing this way leads, however, to a real problem. The environment variable DISLIN has to be set to the DISLIN installation directory, and the win subdirectory of this directory has to be added to the PATH. How can we do this with three different DISLIN installation directories?

In Windows Command Prompt, the command set is used to set an environment variable. However, this environment variable setting is not permanent, but only lasts for the actual Command Prompt session, i.e. when you close Command Prompt, the settings, that you did, are undone. We can use this behavior to write a batch file, that temporarily creates the environment variable DISLIN and temporarily modifies the PATH, depending on the programming language. I called this file dislin.bat and placed it in the C:\Programs\dislin directory. The batch file takes one command line argument: a string, identifying the programming language to be used, and that must have a value equal to the DISLIN installation directory for that language.

Thus, before building a DISLIN Free Pascal program, we have to run dislin.bat with command line argument "fpc". For Free Pascal programs, the batch file has to do the following:

  1. Create the new environment variable DISLIN and set it to the DISLIN installation directory (C:\Programs\dislin\fpc).
  2. Add the win subdirectory of the DISLIN installation directory (C:\Programs\dislin\fpc\win) to the PATH environment variable.

I will show the content of dislin.bat at the end of the tutorial...

Note: Normally the directory containing the Free Pascal compiler is part of the PATH. If it shouldn't be on your system, add it (doing a permanent environment variable modification, as usual).

However, before we may build the provided examples, we have to build the Free Pascal dislin unit. To do so (after having run dislin.bat), cd to the directory containing the examples (subdirectory fpc of the installation directory, i.e. C:\Programs\dislin\fpc\fpc), and run the command
    fpc dislin.pas

The screenshot shows the execution of dislin.bat with command line argument "fpc", followed by the build of dislin.pas (the "illegal parameter" build was my trial to use the syntax as described in the DISLIN for Free Pascal readme file). The result of the build is the compiled unit file dislin.ppu.

DISLIN on Windows: DISLIN for Free Pascal - Building the dislin.pas unit

The dislin unit being located together with the Free Pascal source files, we can now build the examples. To build, for example, the file curve.pas, use the command
    fpc curve.pas

Here is the screenshot of the execution of curve.exe (created by the build of curve.pas).

DISLIN on Windows: DISLIN for Free Pascal - Running the provided example curve.exe

Installing DISLIN for Perl.

The archive to download is called dl<NN>_pl.zip, where NN is the version number. Unpack the archive and run setup.exe. As for Free Pascal, I chose a programming language specific installation directory: C:\Programs\dislin\perl.

Before running a DISLIN Perl script, run dislin.bat with command line argument "perl". For Perl scripts, the batch file has to do the following:

  1. Create the new environment variable DISLIN and set it to your DISLIN installation directory (C:\Programs\dislin\perl).
  2. Add the win subdirectory of the DISLIN installation directory (C:\Programs\dislin\perl\win) to the PATH environment variable.
  3. Set the new environment variable PERL5LIB to the directory containing the Perl module dislin.pm (C:\Programs\dislin\perl\perl).

There is, however, another step to perform, before we are able to run DISLIN Perl scripts: Making sure that the correct version of dislin.dll will be used. In fact, the installation files include DLLs for several versions of Perl, and it is mandatory that the version corresponding to the actually installed version of Perl is used. As I use Perl 5.32, the DLL to be used has to be perl_532.dll. To use this DLL, backup dislin.dll and perl_532.dll, delete dislin.dll, then rename perl_532.dll to dislin.dll.

Now we are ready to run, for example, the script surface.pl: cd to the directory C:\Programs\dislin\perl\perl, and execute the command
    perl surface.pl

Here is the screenshot of the script output:

DISLIN on Windows: DISLIN for Perl - Running the provided example surface.pl

Installing DISLIN for Python.

The archive to download is called dl<NN>_py.zip, where NN is the version number. Unpack the archive and run setup.exe. As for Free Pascal and Perl, I chose a programming language specific installation directory: C:\Programs\dislin\python.

Before running a DISLIN Python script, run dislin.bat with command line argument "python". For Python scripts, the batch file has to do the following:

  1. Create the new environment variable DISLIN and set it to the DISLIN installation directory (C:\Programs\dislin\python).
  2. Add the win subdirectory of the DISLIN installation directory (C:\Programs\dislin\python\win) to the PATH environment variable.
  3. Set the new environment variable PYTHONPATH to the directory containing the Python 3 extension dislin.pyd (C:\Programs\dislin\python\python3).

There is, however, another step to perform, before we are able to run DISLIN Python scripts: Making sure that the correct version of dislin.pyd will be used. In fact, the installation files include files for several versions of Python, and it is mandatory that the version corresponding to the actually installed version of Python is used. With my Python 3.10, the extension to be used has to be dislin_310.pyd. To use this file, backup dislin.pyd and dislin_310.pyd, delete dislin.pyd, then rename dislin_310.pyd to dislin.pyd.

Note: I suppose that all works fine with the other versions of Python 3 (v3.7 - v3.13), too. If you should use the old Python 2, you'll have to use the Python extension (and examples) located in the C:\Programs\dislin\python\python directory.

Now we are ready to run, for example, the script map.py; cd to the directory C:\Programs\dislin\python\python3, and execute the command
    python map.py

Here is the screenshot of the script output. Oh yes, this is a GUI application with a listbox, buttons, and image display written in Python! Really amazing, isn't it?

DISLIN on Windows: DISLIN for Python - Running the provided example map.py (GUI application)

Remains to review the content of the dislin.bat batch file.
    @echo off
    set _LANG=%1
    if "%_LANG%"=="" goto NoLang
    if "%_LANG%"=="fpc" goto Continue
    if "%_LANG%"=="perl" goto Continue
    if "%_LANG%"=="py" set _LANG=python
    if "%_LANG%"=="python" goto Continue
    echo Invalid programming languge "%_LANG%"
    goto End
    :NoLang
    echo Missing programming language
    goto End
    :Continue
    set DISLIN=C:\Programs\dislin\%_LANG%
    rem setx DISLIN C:\Programs\dislin\%_LANG%
    if "%_LANG%"=="perl" set PERL5LIB=C:\Programs\dislin\perl\perl
    if "%_LANG%"=="python" set PYTHONPATH=C:\Programs\dislin\python\python3
    set PATH=%path%;C:\Programs\dislin\%_LANG%\win
    :End
    set _LANG=

The script takes 1 argument, the programming language, that has to be one of "fpc", "perl", or "python" ("py"). Be sure that the value of the arguments correspond to the names of the DISLIN installation directories! If the programming language specified is valid, the script creates the DISLIN environment variable accordingly. It also adds the correct win directory to the PATH. If the Language is "perl", the environment variable PERL5LIB is created, if it is "python", the environment variable PYTHONPATH is created.

Note: If, for one reason or another, you would like to set DISLIN permanently, uncomment the setx command...

Enjoy!


If you find this text helpful, please, support me and this website by signing my guestbook.