#1 2016-11-11 12:05:27

tklaz
Member
Registered: 2016-11-02
Posts: 10

Cross compiling to Android - using Generics.Collections does not work

Hi,
this library compiles fine but won't load when crosscompiled to Android using NewPascal FPC and added to a LAMW application:

library testlib;

{$R *.res}

uses
   Generics.Collections;

function Test: PAnsiChar; cdecl;
begin
  Result := 'This is library text';
end;

exports
  Test;

begin
end.

Without Generics.Collections it runs. With it the LAMW app crashes when trying to load the library.

When compiled under Laz4Android it runs fine and the LAMW app does not crash.

Using the compiler options from LAMW application for the library does not help.

Where could be a problem? Bug in FPC built into Newpascal?
Thanks

Offline

#2 2016-11-11 18:07:00

AOG
Member
Registered: 2014-02-24
Posts: 346

Re: Cross compiling to Android - using Generics.Collections does not work

Could you be more precise ?
Does Laz4Android have Generics.Collections ?
If so, does the app run fine with the combi Laz4Android+Generics.Collections ?

Offline

#3 2016-11-11 19:20:17

hnb
Member
Registered: 2015-06-15
Posts: 250

Re: Cross compiling to Android - using Generics.Collections does not work

Try to add CThreads as first unit before Generics.Collections


best regards,
Maciej Izak

Offline

#4 2016-11-11 21:26:42

tklaz
Member
Registered: 2016-11-02
Posts: 10

Re: Cross compiling to Android - using Generics.Collections does not work

Laz4Android does not have Generics.Collections. I use those from NewPascal.

The app runs fine with these Generics.Collections, when compiled with FPC built into Laz4Android (FPC 3.1.1 2015/10/02).
The app crashes with these Generics.Collections, when compiled with FPC built into Newpascal (FPC 3.1.1 2016/10/22).

Of course different is not only FPC, but also binutils and used libraries.

Adding CThreads does not solve the problem, tried already before.

Offline

#5 2016-11-13 09:32:10

AOG
Member
Registered: 2014-02-24
Posts: 346

Re: Cross compiling to Android - using Generics.Collections does not work

Please post a complete LAMW project, and I will try to reproduce.
Without complete project, I have to guess too much.

Offline

#6 2016-11-14 23:27:16

tklaz
Member
Registered: 2016-11-02
Posts: 10

Re: Cross compiling to Android - using Generics.Collections does not work

Problem found. It is the two distributions of Lazarus I use.
And because I take generics.* units from NewPascal to Laz4Android (have the path to them in fpc.cfg).
Switching from one Lazarus instance to another and compiling the same project in both instances is not a good idea, the linker sometimes takes wrong *.o or *.ppu files.
But clean up and rebuild always helps.

Offline

Board footer

Powered by FluxBB