Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2011-02

Unit initialization on Android library

4 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Dejan Boras

I've got a library which runs on Android, and is loaded by a Java program. The INITIALIZATION sections of units do not seem to be called, is there a way to do this manually, or am I missing something?

Paul Ishenin
to Dejan Boras
Dejan Boras wrote
I've got a library which runs on Android, and is loaded by a Java program. The INITIALIZATION sections of units do not seem to be called, is there a way to do this manually, or am I missing something?

It must be done automatically but you can force it yourself:

program test;
procedure internal_initializeunits; external name 'FPC_INITIALIZEUNITS';
begin
   internal_initializeunits;
end.
Dejan Boras

Okay, this works nicely. I do realize it should be done automatically, but for whatever reason it does not, and I am not sure if this is something Android related or a fpc bug. Thanks.

Earlier message 17 lines
----- Original Message ----- From:Paul Ishenin To:Dejan Boras ; FPC-Pascal users discussions Cc: Sent:Saturday, February 12, 2011 10:48 AM Subject:Re: [fpc-pascal]Unit initialization on Android library 12.02.2011 16:36, Dejan Boras wrote: > I've got a library which runs on Android, and is loaded by a Java program. The INITIALIZATION sections of units do not seem to be called, is there a way to do this manually, or am I missing something? It must be done automatically but you can force it yourself: program test; procedure internal_initializeunits; external name 'FPC_INITIALIZEUNITS'; begin internal_initializeunits; end.
Jeppe Johansen
to Dejan Boras
Dejan Boras wrote
Okay, this works nicely. I do realize it should be done automatically, but for whatever reason it does not, and I am not sure if this is something Android related or a fpc bug. Thanks.

It's probably fpc rtl related. It's a certain flavour of Linux that has some different initialization(init/fini) of shared objects. I can't remember exactly, but I actually thought it was fixed in trunk