GlobalIdentToInt causes shared library to enter zombie state
Original Reporter info from Mantis: tk
-
Reporter name: TK
Original Reporter info from Mantis: tk
- Reporter name: TK
Description:
If I have main program and shared library both written in Lazarus/FPC.
And I cannot display a modal form in the library (.so file).
The function
Form := TForm.Create(nil);
which is located in the library hangs in TReader.ReadPropValue when calling GlobalIdentToInt, causing the module to enter zombie state in Linux kernel.
This bug can be observed under Linux, in Windows it is OK.
This freeze renders forms in shared libraries on Linux not possible (yes there is one working solution http://forum.lazarus.freepascal.org/index.php/topic,8321.msg58906.html#msg58906, but I cannot use this in my case).
Steps to reproduce:
Too much work for me to make a simple demo, however I know the cause.
It is the many global variables which are located at many places across LCL and RTL. There is no way to completely transfer LCL/FCL/RTL context from main program to library due to these static variables.
I tried to make functions (transferring Application, Screen, WidgetSet etc.). However many global variables are private only in implementation clauses!
And I cannot transfer those.
Here it is variable IntConstList.
My feeling is that it is too bad to have those static global variables in RTL and LCL, moreover hidden somewhere in unit implementations. This was the old VCL Delphi approach which I hated.
They should be part of a special class called TApplicationCtx or TRTLContext or the like, to be easily transferrable between modules written in Lazarus or FPC.
So that main program and shared library can display forms in one context.