0

I have installed the latest JCL 2016-10-10 and I want to install the latest JVCL, but I'm getting some error messages.

How I can install it?

Windows 10 Home (10.0.0)

JVCL 3.50.0.0

[Generating: Packages]

Generating packages for D24

Loaded template.dpk

Loaded template.dproj

Loaded template.rc

[Compiling: Packages]

[Compiling: JvCore240.bpl]

Embarcadero Delphi for Win32 compiler version 31.0

Copyright (c) 1983,2016 Embarcadero Technologies, Inc.

E:\DelphiComp\XE10.1\JVCL3-2016-10-10\run\JvAppIniStorage.pas(261) Error: E2361 Cannot access private symbol TMemIniFile.FSections

E:\DelphiComp\XE10.1\JVCL3-2016-10-10\run\JvAppIniStorage.pas(261) Warning: W1023 Comparing signed and unsigned types - widened both operands

E:\DelphiComp\XE10.1\JVCL3-2016-10-10\run\JvAppIniStorage.pas(261) Error: E2014 Statement expected, but expression of type 'Boolean' found

E:\DelphiComp\XE10.1\JVCL3-2016-10-10\run\JvAppIniStorage.pas(274) Error: E2361 Cannot access private symbol TMemIniFile.FSections

JvCore.dpk(2356) Fatal: F2063 Could not compile used unit 'JvAppIniStorage.pas'

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
  • 1
    You say that you are trying to install the latest, but you aren't. This issue was fixed back in April. This is such a common mistake. Make sure you know how to use VCS and get the latest. – David Heffernan Oct 11 '16 at 09:01

1 Answers1

1

The Delphi 10.1 Berlin version removed the access of private members through class helpers (see How to access private methods without helpers?). That is the error message you can see, when access to TMemIniFile.FSections is denied.

Looking at the latest code for JvAppIniStorage.pas, this is fixed:

{ Optimization of TCustomIniFile.ValueExists.
  Note that this is a dirty hack, a better way would be to rewrite TMemIniFile;
  especially expose FSections. }
{$IFDEF DELPHI2009_UP}
type
  TMemIniFileAccess = class(TCustomIniFile)
  {$IFDEF RTL310_UP} // 10.1 Berlin removed the access to private fields
    {$IFDEF RTL320_UP}
      {$MESSAGE WARN 'Check that the new RTL still has FSections as the first member of TMemIniFile'}
    {$ENDIF RTL320_UP}
  private
    FSections: TStringList;
  {$ENDIF RTL310_UP}
  end;

As said in code comments, this is a dirty hack that works if the FSections still is declared as the first field in TCustomIniFile.

And in code:

function TMemIniFileHelper.SectionExists(const Section: string): Boolean;
begin
  {$IFDEF RTL310_UP} // 10.1 Berlin removed the access to private fields
  Result := TMemIniFileAccess(Self).FSections.IndexOf(Section) >= 0;
  {$ELSE}
  Result := Self.FSections.IndexOf(Section) >= 0;
  {$ENDIF RTL310_UP}
end;

Make sure you have the latest source for jvcl and recompile. Note that the symbol RTL310_UP is defined in jedi.inc.

Community
  • 1
  • 1
LU RD
  • 34,438
  • 5
  • 88
  • 296
  • @DavidHeffernan, from an oop point of view perhaps, but a pragmatic programmer use whatever option there is. – LU RD Oct 11 '16 at 09:05
  • Hi David,Thank you for your comments. But I can't do it. – Osman Taşkıran Oct 11 '16 at 18:35
  • I have downloaded latest sources via SourceTree. I have installed jcl successfully. But jvcl has same error message. – Osman Taşkıran Oct 11 '16 at 18:38
  • Did you confirm that `jedi.inc` includes the `RTL310_UP` definition? – LU RD Oct 11 '16 at 18:40
  • @OsmanTaşkıran, it is clear to me that your `JvAppIniStorage.pas` is the updated version, but also that your `jedi.inc` is wrong. If you look at the compiler error line numbers (Line 261), they match the path of the `{$ELSE}` directive in the `SectionExists()` snippet above. If the `inc` file contained the correct definition, the compiler would have compiled line 259 (`Result := TMemIniFileAccess(Self).FSections.IndexOf(Section) >= 0;`) instead. – LU RD Oct 11 '16 at 21:57