Passing array of packed array of char to Fortran?
Posted: Fri Aug 20, 2021 1:32 pm
A routine is written in Fortran (F77) and has parameters:
Using Fortran, I can pass an array of character strings directly:
In Pascal, I created an interface to this routine:
following the Pascal userguide and language reference.
Similar call in Pascal, as in Fortran:
which should be sufficient: Name is passed correctly, but the array of packed array of char is not recognized by the Fortran routine as an array, but just one line of characters. Where I need the array....
What have I missed?
Code: Select all
Function F (Name, Number, datadata): integer;
character*(*) Name
integer*4 Number
character*(*) datadata(*)
Code: Select all
program T
structure /d2/
union
map
character*18 dummy
endmap
map
character*2 nr
character*6 dat1(2)
character*4 dat2
endmap
endunion
endstructure
record /d2/ blok2(50)
integer*4 aantal
character*4 N
(fill data, N="aName", 10 lines of data (so Aantal = 10))
i_status = F (N, aantal, blok2(1).dummy)
if (.not. i_status) call lib$signal (i_status)
...
Code: Select all
[external]
function F (Name : [CLASS_S]OF PACKED ARRAY[L1..H1:INTEGER] OF CHAR
Number : integer ;
Datadata : [CLASS_A]ARRAY [L2..H2:INTEGER] OF PACKED ARRAY[L3..H3:INTEGER] OF CHAR) : integer ; external ;
Similar call in Pascal, as in Fortran:
Code: Select all
Program T
var
BlokT: array [1..65] of packed array[1..132] of char;
aantal: Integer;
...
status := F("aName", aantal, blok2);
if not odd (status) then call lib$signal (status);
What have I missed?