Silverfrost Forums

Welcome to our forums

Clearwin plugs for Linux

5 Nov 2023 10:24 (Edited: 6 Nov 2023 5:58) #30698

Can Silverfrost create the linkable library of blank plugs for all Clearwin controls and functions for the FTN95+Clearwin source code for Windows to be able to be compiled with any Fortran for Linux?

I do not mean to create the full working Clearwin code for Linux. I mean to have just the empty functions which will do nothing. They will be just really empty, have no source code, just the declarations dummies needed to trick the Linux compiler to swallow the entire FTN95 source code with Clearwin for Windows and compile it without complaints..

Things are that the code can be made workable with and without GUI. The GUI of course make it muuuch more usable but since there exist difficulties to create and support two sets of Clearwin, one for Windows and another for Linux, this could be pretty useful workaround. Otherwise user have to remove or comment out all these lines with Clearwin controls and functions and maintain two sets of code, one for Windows with GUI and another for Linux without GUI.

On my own Linux computer/supercomputer i do not need this, Clearwin works on Linux like on its own Windows without me doing any additional steps -- you click on Windows EXE file and the program starts, same on Linux, you click on the same Windows created EXE file and, what a miracle!, it also starts -- but on remote public supercomputers where it is not allowed to install Windows emulators in any form, Wine, Bottle or VirtualBox, i am stuck to modify the code for its software.

  1. I can change 'call winop@...' to 'call winop#..., no problem, Windows also works with #.

  2. change include <windows.ins> and <clearwin.ins> to 'include mswin' and can make fake mswin.mod and clrwin.mod

  3. change integer (7) to integer (2) or to integer (3?) since I will not need any 32-bit code anymore... 32-bits are dead.

  4. fix declarations gFortran does not like, it does not like even naturally looking integer8 thinking it is integer4

    integer*8, parameter :: nTotalFieldCells = 28000000000 Error: Integer too big for its kind. This check can be disabled with the option ‘-fno-range-check’

6 Nov 2023 12:03 #30699

Quoted from DanRRight ... it (Gfortran) does not like even naturally looking integer8 thinking it is integer4

integer*8, parameter :: nTotalFieldCells = 28000000000
Error: Integer too big for its kind. This check can be disabled with the option ‘-fno-range-check’

You are misdiagnosing the error. The literal integer 28000000000 is a default integer, which is only 4 bytes long. That size is not enough to represent 28 billion. Try the following code:

module mod
   implicit none
   integer*8, parameter :: i8 = 28000000000_8
end module

If you want the code to work with other compilers, do not use '8' as the kind number, but use SELECTED_INTEGER_KIND and write portable code.

6 Nov 2023 12:55 #30700

Thanks, mecej4, Usually i do this way. I do one general declaration

INTEGER, PARAMETER :: i8  = SELECTED_INT_KIND(18) ! 8-byte 2^63 ~ 10^18

and then any multiple integer*8 ones declare

INTEGER(i8) :: TotalFieldCells = 280000000000

Any objections ?

6 Nov 2023 2:05 #30701

Instead of

INTEGER(i8) :: TotalFieldCells = 280000000000

you need to write

INTEGER(i8) :: TotalFieldCells = 280000000000_i8

If you don't do that, you are attempting to initialize an 8-byte integer with a 4-byte value. Some Fortran compilers may promote the 4-byte value to an 8-byte value, either with default options or with a specific option, but you cannot count on that being done consistently.

6 Nov 2023 6:33 #30702

And i thought what for needed this perversion with underscore a la 123_8 when all works with 123 just fine... With FTN95 this even does not work

module mod
   implicit none
   integer*8, parameter :: i8 = 28000000000_8
end module

*** Invalid KIND specifier
    1 ERROR  [<MOD> FTN95 v8.97.2]
*** Compilation failed

while it automatically promotes the constant

i8 = 28000000000

WARNING - Constant is out of range for INTEGER(KIND=3) - has been promoted to 
    INTEGER(KIND=4)
    NO ERRORS

to fit 28 billion 😃

By the way are integer kind(3) and kind(4) the same in FTN95 and gFortran and Intel VF ? Otherwise i will have even more trouble with all that ...

6 Nov 2023 8:15 #30703

For _4, _8, etc. use /alt_kinds on the FTN95 comand line.

Using ClearWin+ with gFortran and iFort is described here... https://www.youtube.com/watch?v=50BY9gyNY2o

6 Nov 2023 9:01 #30704

Paul, thanks with the Kinds, as to gfortran- the compilation using gfortran has to be performed on supercomputer under Linux. My understanding is that Linux Fortran will not accept any libraries made under Windows unless they are in a source code. Do the sources exist? With Windows gfortran I played a bit and it worked with Clearwin

6 Nov 2023 10:29 #30705

The ClearWin+ library is written in C/C++ but the source code is not in the public domain.

Please login to reply.