[fpc-pascal] FPC on ARM (eg Zaurus)

Florian Klaempfl F.Klaempfl at gmx.de
Wed Nov 24 16:47:55 CET 2004


Den Jean wrote:
> On Tuesday 23 November 2004 11:13 am, Florian Klaempfl wrote:
> 
>  * dynamic arrays : TIntArray = array of integer.
>     On Intel it works fine but on arm not.
>     Bindhelp.pas provides TIntArray pascal helper functions to the binding that is written in C++
> 
>     eg. this C-code copies integers from the Qt Int Array to the Pascal dynamic Array of integer
> 
> ---------------------------------------------------------------------------------------------------
>     inline void copyQIntsToPInts(const QValueList<int> &qi, PIntArray pi)
>   {
>     int len = qi.count();
>     int *ints;
>     setIntsLength(pi, len); // this is call to a pascal SetIntsLength function
>     ints = (int *)getIntsPtr(pi);  // this is a call to a pascal GetIntsPtr function
>     for (int i = 0; i < len; i++)
>       ints[i] = qi[i]; // here it crashes
>   }
> ----------------------------------------------------------------------------------------------------
> 
>     I crashes when it uses the address returned by getintsptr
>     GetIntsPtr is provided by bindhelp.pas:
> ----------------------------------------------------------------------------------------------------
>   // Int array helpers
>   function GetIntsPtr(const PA: TIntArray): Pointer; cdecl; export;
>   begin
>     Result := @PA[0];
>   end;^

I fear the snapshot was created before a lot of dyn. array stuff was fixed.

> ----------------------------------------------------------------------------------------------------
> 
> It works on intel and not on arm. 
> But when I change the definition of GetIntsPtr to:
> 
> ----------------------------------------------------------------------------------------------------
>   function GetIntsPtr(var PA: TIntArray): Pointer; cdecl; export;
>   begin
>     Result := @PA[0];
>   end;
> ----------------------------------------------------------------------------------------------------
> 
> Then it works on the arm to. (changed const to var !)
> 
> By the way the definition of the pascal library function in the C++ library is:
> ----------------------------------------------------------------------------------------------------
>   typedef void *PIntArray;
>   typedef void *(*GetIntsPtr)(PIntArray pi);
>   extern GetIntsPtr getIntsPtr;
> ----------------------------------------------------------------------------------------------------
> 
> *  I am using the last arm snapshot you provided because the current cvs version does not compile

I know, but I've to get my arm working first :(

> 
>                                
> 
>>BTW: What OS do you run on your Zaurus? I've a lot of trouble with  
>>OZ 3.5.1 e.g. with that ridiculous dropbear ssh demon used by OZ 3.5.1
> 
> 
> I have a Zaurus SL6000. As it is rather new, an upgrade was not a priority yet.
> I haven't seen update roms for the SL6000 either.
> The SL6000 has a libqte.so.2.3.2 and a libqpe.so.1.5.0
>





More information about the fpc-pascal mailing list