Hello,
I have the following code which calls a procedure in a dll( matrix multiplication) however I'm getting a SIGSEGV error message. If I change the dynamic arrays to static ones then it runs okay. Any ideas what I'm doing wrong? Another question, does MyArray[2,3] mean second column third row, or the other way round? Many thanks.
Regards Albert
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
StringGrid1: TStringGrid;
procedure Button1Click(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
type tarray= array of array of double;
var
Form1: TForm1;
a,b,c: tarray;
n:integer;
procedure testblas31_MP_testdgemm(var a,b,c: tarray;var n:integer); cdecl; external 'testblas31.dll' ;
implementation
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
var
i,j:integer;
begin
n:=2;
setlength(a,n,n);
setlength(b,n,n);
setlength(c,n,n);
a[0,0]:= 3.5;
a[1,0]:= 2.4;
a[0,1]:= 4.9;
a[1,1]:= 6.7;
b[0,0]:= 1.3;
b[1,0]:= 8.9;
b[0,1]:= 4.4;
b[1,1]:= 3.5;
for i:=0 to 1 do
for j:=0 to 1 do
c[i,j]:=0.0;
testblas31_MP_testdgemm(a,b,c,n);
for i:=0 to 1 do
for j:=0 to 1 do
stringgrid1.Cells[i,j] := floattostr(c[i,j]);
end;
initialization
{$I unit1.lrs}
end.