risoflora / brookframework

Microframework which helps to develop web Pascal applications.
https://risoflora.github.io/brookframework
GNU Lesser General Public License v2.1
239 stars 54 forks source link

can not compile for Delphi Tokyo 10.2 - 10.2.3 under Linux (System.Contnrs not allowed) #17

Closed KaitoNakamura closed 3 years ago

KaitoNakamura commented 4 years ago

Hello in Delphi 10.2 - 10.2.3 there is a problem under Linux that "System.Contnrs" is not accepted. The exchange of "System.Contnrs" with "System.Generics.Collections" solves the problem.

Environment:

In the code the following code : 

  TSgUnloadEvents = class sealed
  private
    FCS: TCriticalSection;
    FList: TObjectList;
  protected
    property CS: TCriticalSection read FCS;
    property List: TObjectList read FList;

convert to :

  TSgUnloadEvents = class sealed
  private
    FCS: TCriticalSection;
    FList: TObjectList<TSgLibUnloadHolder>;
  protected
    property CS: TCriticalSection read FCS;
    property List: TObjectList<TSgLibUnloadHolder> read FList;

change Constructor Code  :

constructor TSgUnloadEvents.Create(ACS: TCriticalSection);
begin
  inherited Create;
  if not Assigned(ACS) then
    raise EArgumentNilException.CreateFmt(SParamIsNil, ['ACS']);
  FList := TObjectList.Create;

convert to :

constructor TSgUnloadEvents.Create(ACS: TCriticalSection);
begin
  inherited Create;
  if not Assigned(ACS) then
    raise EArgumentNilException.CreateFmt(SParamIsNil, ['ACS']);
  FList := TObjectList<TSgLibUnloadHolder>.Create;

Unfortunately the class "TSgLibUnloadHolder" has to go up as well.

PS: After this conversion, it works wonderfully.

silvioprog commented 4 years ago

Hi @KaitoNakamura , thanks for reporting with detailed info.

I'm going to test it on FPC and apply the suggested changes ...