Hi,

There seems to be an ARM ABI bug with passing doubles on arm.

When I call a C-procedure of a library using a c-program, it works.

When I call the C-procedure using a fpc ARM program it doesn't work.

Here is an example:

definition of the c-procedure to call
void QLCDNumber_display2(QLCDNumberH handle, double num);

use of the c-procedure in a c-program that works fine:
QLCDNumber_display2(lcd,142.3);

use of the c-procedure in a pascal program (does not work)
procedure QLCDNumber_display(handle: QLCDNumberH; num: Double); cdecl; 
overload;  external QtShareName name 'QLCDNumber_display2';
QLCDNumber_Display(lcd,142.3);


but this trick works:
procedure QLCDNumber_display_trick(handle: QLCDNumberH; hinum,lonum:integer); 
cdecl; overload;  external QtShareName name 'QLCDNumber_display2';
type
  TDoubleRec = record
    Hi : integer;
    Lo : integer;
  end;
  PDoubleRec = ^TDoubleRec;

..... 
var
  d : double;
  p : PDoubleRec; 
......
d:=142.3;       
p:=PDoubleRec(@d);
QLCDNumber_Display_trick(l,p^.hi,p^.lo);

I used :
Free Pascal Compiler version 2.0.1 [2005/07/21] for arm


kind regards,

Den Jean

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to