[Lazarus] procedure calls with variable sized arrays in parameter list?

Bo Berglund bo.berglund at gmail.com
Fri Oct 8 11:55:50 CEST 2010


On Thursday 07 October 2010 23:33:37 Bo Berglund wrote:
> What I meant is that I found the Delphi code for the ForToPas program.
> Since it did not work I tried to open the ForToPas project in D7 and
> correct the erroneous code. But it is written in a very strange way so
> it would need a lot of going over to make it work for converting the
> Fortran code to Pascal.

Apparently the automatic conversion doesn't work. You must do it manually.
It is not only a bad thing because then you also must understand the code 
while converting it.

> Concerning the DLL:s I have the Windows binaries and I have the
> Fortran90 sourcecode including the VisualSydio sln file (the compiler
> was plugged into Visual Studio at the time).

Good. That's what I meant. You can use them to verify that your conversion is 
correct.

> But my goal is to convert the functions into pascal so they can be
> compiled with FPC on both Windows and Linux.
> And I don't need them to be DLL:s or the equivalent for Linux either,
> they may as well be ordinary procedures called from the code in the
> normal embedded way. I just do not understand what they are doing
> since I don't read Fortran.

Learn to read it. It can't be very difficult. For example C++ is a complicated 
and difficult language but Fortran is an old and primitive language. You should 
be able to learn the syntax quickly. Your code is arithmetic calculation which 
should map to Pascal's math operators and functions nicely.
Googling for "Fortran tutorial" gives for example:
  http://www.cs.mtu.edu/~shene/COURSES/cs201/NOTES/fortran.html
which looks good.

After you understood what the functions do and converted them, then create a 
test program that feeds different input to every function and compares their 
output with the original Fortran functions' output. You can even create a 
test-version of the real program which calls those functions, by adding 
another call for the converted function and then comparing the results.

Juha




More information about the Lazarus mailing list